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 * Used to give chain error details upstream
15 typedef enum LDKChainError {
17 * Client doesn't support UTXO lookup (but the chain hash matches our genesis block hash)
19 LDKChainError_NotSupported,
21 * Chain isn't the one watched
23 LDKChainError_NotWatched,
25 * Tx doesn't exist or is unconfirmed
27 LDKChainError_UnknownTx,
29 * Must be last for serialization purposes
31 LDKChainError_Sentinel,
35 * An error enum representing a failure to persist a channel monitor update.
37 typedef enum LDKChannelMonitorUpdateErr {
39 * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
40 * our state failed, but is expected to succeed at some point in the future).
42 * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
43 * submitting new commitment transactions to the counterparty. Once the update(s) which failed
44 * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
45 * restore the channel to an operational state.
47 * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
48 * you return a TemporaryFailure you must ensure that it is written to disk safely before
49 * writing out the latest ChannelManager state.
51 * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
52 * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
53 * to claim it on this channel) and those updates must be applied wherever they can be. At
54 * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
55 * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
56 * the channel which would invalidate previous ChannelMonitors are not made when a channel has
59 * Note that even if updates made after TemporaryFailure succeed you must still call
60 * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
63 * Note that the update being processed here will not be replayed for you when you call
64 * ChannelManager::channel_monitor_updated, so you must store the update itself along
65 * with the persisted ChannelMonitor on your own local disk prior to returning a
66 * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
67 * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
70 * For deployments where a copy of ChannelMonitors and other local state are backed up in a
71 * remote location (with local copies persisted immediately), it is anticipated that all
72 * updates will return TemporaryFailure until the remote copies could be updated.
74 LDKChannelMonitorUpdateErr_TemporaryFailure,
76 * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
77 * different watchtower and cannot update with all watchtowers that were previously informed
80 * At reception of this error, ChannelManager will force-close the channel and return at
81 * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
82 * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
83 * update must be rejected.
85 * This failure may also signal a failure to update the local persisted copy of one of
86 * the channel monitor instance.
88 * Note that even when you fail a holder commitment transaction update, you must store the
89 * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
90 * broadcasts it (e.g distributed channel-monitor deployment)
92 LDKChannelMonitorUpdateErr_PermanentFailure,
94 * Must be last for serialization purposes
96 LDKChannelMonitorUpdateErr_Sentinel,
97 } LDKChannelMonitorUpdateErr;
100 * An enum that represents the speed at which we want a transaction to confirm used for feerate
103 typedef enum LDKConfirmationTarget {
105 * We are happy with this transaction confirming slowly when feerate drops some.
107 LDKConfirmationTarget_Background,
109 * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
111 LDKConfirmationTarget_Normal,
113 * We'd like this transaction to confirm in the next few blocks.
115 LDKConfirmationTarget_HighPriority,
117 * Must be last for serialization purposes
119 LDKConfirmationTarget_Sentinel,
120 } LDKConfirmationTarget;
123 * An enum representing the available verbosity levels of the logger.
125 typedef enum LDKLevel {
127 *Designates logger being silent
131 * Designates very serious errors
135 * Designates hazardous situations
139 * Designates useful information
143 * Designates lower priority information
147 * Designates very low priority, often extremely verbose, information
151 * Must be last for serialization purposes
156 typedef enum LDKNetwork {
161 * Must be last for serialization purposes
166 typedef enum LDKSecp256k1Error {
167 LDKSecp256k1Error_IncorrectSignature,
168 LDKSecp256k1Error_InvalidMessage,
169 LDKSecp256k1Error_InvalidPublicKey,
170 LDKSecp256k1Error_InvalidSignature,
171 LDKSecp256k1Error_InvalidSecretKey,
172 LDKSecp256k1Error_InvalidRecoveryId,
173 LDKSecp256k1Error_InvalidTweak,
174 LDKSecp256k1Error_NotEnoughMemory,
175 LDKSecp256k1Error_CallbackPanicked,
177 * Must be last for serialization purposes
179 LDKSecp256k1Error_Sentinel,
182 typedef struct LDKCVecTempl_u8 {
187 typedef LDKCVecTempl_u8 LDKCVec_u8Z;
190 * A transaction output including a scriptPubKey and value.
191 * This type *does* own its own memory, so must be free'd appropriately.
193 typedef struct LDKTxOut {
194 LDKCVec_u8Z script_pubkey;
199 * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
200 * look up the corresponding function in rust-lightning's docs.
202 typedef struct LDKThirtyTwoBytes {
206 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__u32 {
207 LDKThirtyTwoBytes *a;
209 } LDKC2TupleTempl_ThirtyTwoBytes__u32;
211 typedef LDKC2TupleTempl_ThirtyTwoBytes__u32 LDKC2Tuple_Txidu32Z;
213 typedef struct LDKC2TupleTempl_CVec_u8Z__u64 {
216 } LDKC2TupleTempl_CVec_u8Z__u64;
218 typedef LDKC2TupleTempl_CVec_u8Z__u64 LDKC2Tuple_Scriptu64Z;
220 typedef struct LDKC2TupleTempl_u64__u64 {
223 } LDKC2TupleTempl_u64__u64;
225 typedef LDKC2TupleTempl_u64__u64 LDKC2Tuple_u64u64Z;
227 typedef struct LDKSignature {
228 uint8_t compact_form[64];
231 typedef struct LDKCVecTempl_Signature {
234 } LDKCVecTempl_Signature;
236 typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature {
238 LDKCVecTempl_Signature *b;
239 } LDKC2TupleTempl_Signature__CVecTempl_Signature;
241 typedef LDKC2TupleTempl_Signature__CVecTempl_Signature LDKC2Tuple_SignatureCVec_SignatureZZ;
243 typedef LDKCVecTempl_Signature LDKCVec_SignatureZ;
245 typedef union LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 {
246 LDKC2TupleTempl_Signature__CVecTempl_Signature *result;
248 } LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8;
250 typedef struct LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 {
251 LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 contents;
253 } LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8;
255 typedef LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
257 typedef union LDKCResultPtr_Signature__u8 {
258 LDKSignature *result;
260 } LDKCResultPtr_Signature__u8;
262 typedef struct LDKCResultTempl_Signature__u8 {
263 LDKCResultPtr_Signature__u8 contents;
265 } LDKCResultTempl_Signature__u8;
267 typedef LDKCResultTempl_Signature__u8 LDKCResult_SignatureNoneZ;
269 typedef union LDKCResultPtr_CVecTempl_Signature_____u8 {
270 LDKCVecTempl_Signature *result;
272 } LDKCResultPtr_CVecTempl_Signature_____u8;
274 typedef struct LDKCResultTempl_CVecTempl_Signature_____u8 {
275 LDKCResultPtr_CVecTempl_Signature_____u8 contents;
277 } LDKCResultTempl_CVecTempl_Signature_____u8;
279 typedef LDKCResultTempl_CVecTempl_Signature_____u8 LDKCResult_CVec_SignatureZNoneZ;
282 * A Rust str object, ie a reference to a UTF8-valid string.
283 * This is *not* null-terminated so cannot be used directly as a C string!
285 typedef struct LDKStr {
286 const uint8_t *chars;
291 * Indicates an error on the client's part (usually some variant of attempting to use too-low or
294 typedef enum LDKAPIError_Tag {
296 * Indicates the API was wholly misused (see err for more). Cases where these can be returned
297 * are documented, but generally indicates some precondition of a function was violated.
299 LDKAPIError_APIMisuseError,
301 * Due to a high feerate, we were unable to complete the request.
302 * For example, this may be returned if the feerate implies we cannot open a channel at the
303 * requested value, but opening a larger channel would succeed.
305 LDKAPIError_FeeRateTooHigh,
307 * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
308 * too-many-hops, etc).
310 LDKAPIError_RouteError,
312 * We were unable to complete the request as the Channel required to do so is unable to
313 * complete the request (or was not found). This can take many forms, including disconnected
314 * peer, channel at capacity, channel shutting down, etc.
316 LDKAPIError_ChannelUnavailable,
318 * An attempt to call add/update_monitor returned an Err (ie you did this!), causing the
319 * attempted action to fail.
321 LDKAPIError_MonitorUpdateFailed,
323 * Must be last for serialization purposes
325 LDKAPIError_Sentinel,
328 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
330 } LDKAPIError_LDKAPIMisuseError_Body;
332 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
335 } LDKAPIError_LDKFeeRateTooHigh_Body;
337 typedef struct LDKAPIError_LDKRouteError_Body {
339 } LDKAPIError_LDKRouteError_Body;
341 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
343 } LDKAPIError_LDKChannelUnavailable_Body;
345 typedef struct LDKAPIError {
348 LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
349 LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
350 LDKAPIError_LDKRouteError_Body route_error;
351 LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
355 typedef union LDKCResultPtr_u8__APIError {
358 } LDKCResultPtr_u8__APIError;
360 typedef struct LDKCResultTempl_u8__APIError {
361 LDKCResultPtr_u8__APIError contents;
363 } LDKCResultTempl_u8__APIError;
365 typedef LDKCResultTempl_u8__APIError LDKCResult_NoneAPIErrorZ;
370 * If a payment fails to send, it can be in one of several states. This enum is returned as the
371 * Err() type describing which state the payment is in, see the description of individual enum
374 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
376 * Nearly everyhwere, inner must be non-null, however in places where
377 * the Rust equivalent takes an Option, it may be set to null to indicate None.
379 LDKnativePaymentSendFailure *inner;
381 } LDKPaymentSendFailure;
383 typedef union LDKCResultPtr_u8__PaymentSendFailure {
385 LDKPaymentSendFailure *err;
386 } LDKCResultPtr_u8__PaymentSendFailure;
388 typedef struct LDKCResultTempl_u8__PaymentSendFailure {
389 LDKCResultPtr_u8__PaymentSendFailure contents;
391 } LDKCResultTempl_u8__PaymentSendFailure;
393 typedef LDKCResultTempl_u8__PaymentSendFailure LDKCResult_NonePaymentSendFailureZ;
395 typedef union LDKCResultPtr_u8__ChannelMonitorUpdateErr {
397 LDKChannelMonitorUpdateErr *err;
398 } LDKCResultPtr_u8__ChannelMonitorUpdateErr;
400 typedef struct LDKCResultTempl_u8__ChannelMonitorUpdateErr {
401 LDKCResultPtr_u8__ChannelMonitorUpdateErr contents;
403 } LDKCResultTempl_u8__ChannelMonitorUpdateErr;
405 typedef LDKCResultTempl_u8__ChannelMonitorUpdateErr LDKCResult_NoneChannelMonitorUpdateErrZ;
410 * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
411 * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
412 * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
414 * Contains a human-readable error message.
416 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
418 * Nearly everyhwere, inner must be non-null, however in places where
419 * the Rust equivalent takes an Option, it may be set to null to indicate None.
421 LDKnativeMonitorUpdateError *inner;
423 } LDKMonitorUpdateError;
425 typedef union LDKCResultPtr_u8__MonitorUpdateError {
427 LDKMonitorUpdateError *err;
428 } LDKCResultPtr_u8__MonitorUpdateError;
430 typedef struct LDKCResultTempl_u8__MonitorUpdateError {
431 LDKCResultPtr_u8__MonitorUpdateError contents;
433 } LDKCResultTempl_u8__MonitorUpdateError;
435 typedef LDKCResultTempl_u8__MonitorUpdateError LDKCResult_NoneMonitorUpdateErrorZ;
440 * A reference to a transaction output.
442 * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
443 * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
445 typedef struct MUST_USE_STRUCT LDKOutPoint {
447 * Nearly everyhwere, inner must be non-null, however in places where
448 * the Rust equivalent takes an Option, it may be set to null to indicate None.
450 LDKnativeOutPoint *inner;
454 typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z {
457 } LDKC2TupleTempl_OutPoint__CVec_u8Z;
459 typedef LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ;
464 * A channel_announcement message to be sent or received from a peer
466 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
468 * Nearly everyhwere, inner must be non-null, however in places where
469 * the Rust equivalent takes an Option, it may be set to null to indicate None.
471 LDKnativeChannelAnnouncement *inner;
473 } LDKChannelAnnouncement;
478 * A channel_update message to be sent or received from a peer
480 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
482 * Nearly everyhwere, inner must be non-null, however in places where
483 * the Rust equivalent takes an Option, it may be set to null to indicate None.
485 LDKnativeChannelUpdate *inner;
489 typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
490 LDKChannelAnnouncement *a;
493 } LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
495 typedef LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
500 * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
501 * generate no further read_event/write_buffer_space_avail calls for the descriptor, only
502 * triggering a single socket_disconnected call (unless it was provided in response to a
503 * new_*_connection event, in which case no such socket_disconnected() must be called and the
504 * socket silently disconencted).
506 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
508 * Nearly everyhwere, inner must be non-null, however in places where
509 * the Rust equivalent takes an Option, it may be set to null to indicate None.
511 LDKnativePeerHandleError *inner;
513 } LDKPeerHandleError;
515 typedef union LDKCResultPtr_u8__PeerHandleError {
517 LDKPeerHandleError *err;
518 } LDKCResultPtr_u8__PeerHandleError;
520 typedef struct LDKCResultTempl_u8__PeerHandleError {
521 LDKCResultPtr_u8__PeerHandleError contents;
523 } LDKCResultTempl_u8__PeerHandleError;
525 typedef LDKCResultTempl_u8__PeerHandleError LDKCResult_NonePeerHandleErrorZ;
530 * Information about an HTLC as it appears in a commitment transaction
532 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
534 * Nearly everyhwere, inner must be non-null, however in places where
535 * the Rust equivalent takes an Option, it may be set to null to indicate None.
537 LDKnativeHTLCOutputInCommitment *inner;
539 } LDKHTLCOutputInCommitment;
541 typedef struct LDKC2TupleTempl_HTLCOutputInCommitment__Signature {
542 LDKHTLCOutputInCommitment *a;
544 } LDKC2TupleTempl_HTLCOutputInCommitment__Signature;
546 typedef LDKC2TupleTempl_HTLCOutputInCommitment__Signature LDKC2Tuple_HTLCOutputInCommitmentSignatureZ;
548 typedef struct LDKPublicKey {
549 uint8_t compressed_form[33];
553 * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
554 * claim at any point in the future) an event is generated which you must track and be able to
555 * spend on-chain. The information needed to do this is provided in this enum, including the
556 * outpoint describing which txid and output index is available, the full output which exists at
557 * that txid/index, and any keys or other information required to sign.
559 typedef enum LDKSpendableOutputDescriptor_Tag {
561 * An output to a script which was provided via KeysInterface, thus you should already know
562 * how to spend it. No keys are provided as rust-lightning was never given any keys - only the
563 * script_pubkey as it appears in the output.
564 * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
565 * on-chain using the payment preimage or after it has timed out.
567 LDKSpendableOutputDescriptor_StaticOutput,
569 * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
571 * The witness in the spending input should be:
572 * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
574 * Note that the nSequence field in the spending input must be set to to_self_delay
575 * (which means the transaction is not broadcastable until at least to_self_delay
576 * blocks after the outpoint confirms).
578 * These are generally the result of a \"revocable\" output to us, spendable only by us unless
579 * it is an output from an old state which we broadcast (which should never happen).
581 * To derive the delayed_payment key which is used to sign for this input, you must pass the
582 * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
583 * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
584 * chan_utils::derive_private_key. The public key can be generated without the secret key
585 * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
586 * ChannelKeys::pubkeys().
588 * To derive the revocation_pubkey provided here (which is used in the witness
589 * script generation), you must pass the counterparty revocation_basepoint (which appears in the
590 * call to ChannelKeys::on_accept) and the provided per_commitment point
591 * to chan_utils::derive_public_revocation_key.
593 * The witness script which is hashed and included in the output script_pubkey may be
594 * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
595 * (derived as above), and the to_self_delay contained here to
596 * chan_utils::get_revokeable_redeemscript.
598 LDKSpendableOutputDescriptor_DynamicOutputP2WSH,
600 * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
601 * corresponds to the public key in ChannelKeys::pubkeys().payment_point).
602 * The witness in the spending input, is, thus, simply:
603 * <BIP 143 signature> <payment key>
605 * These are generally the result of our counterparty having broadcast the current state,
606 * allowing us to claim the non-HTLC-encumbered outputs immediately.
608 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment,
610 * Must be last for serialization purposes
612 LDKSpendableOutputDescriptor_Sentinel,
613 } LDKSpendableOutputDescriptor_Tag;
615 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
616 LDKOutPoint outpoint;
618 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
620 typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
621 LDKOutPoint outpoint;
622 LDKPublicKey per_commitment_point;
623 uint16_t to_self_delay;
625 LDKC2Tuple_u64u64Z key_derivation_params;
626 LDKPublicKey revocation_pubkey;
627 } LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
629 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
630 LDKOutPoint outpoint;
632 LDKC2Tuple_u64u64Z key_derivation_params;
633 } LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body;
635 typedef struct LDKSpendableOutputDescriptor {
636 LDKSpendableOutputDescriptor_Tag tag;
638 LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
639 LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh;
640 LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment;
642 } LDKSpendableOutputDescriptor;
644 typedef struct LDKCVecTempl_SpendableOutputDescriptor {
645 LDKSpendableOutputDescriptor *data;
647 } LDKCVecTempl_SpendableOutputDescriptor;
649 typedef LDKCVecTempl_SpendableOutputDescriptor LDKCVec_SpendableOutputDescriptorZ;
652 * An Event which you should probably take some action in response to.
654 * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
655 * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
656 * written as it makes no sense to respond to it after reconnecting to peers).
658 typedef enum LDKEvent_Tag {
660 * Used to indicate that the client should generate a funding transaction with the given
661 * parameters and then call ChannelManager::funding_transaction_generated.
662 * Generated in ChannelManager message handling.
663 * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
664 * counterparty can steal your funds!
666 LDKEvent_FundingGenerationReady,
668 * Used to indicate that the client may now broadcast the funding transaction it created for a
669 * channel. Broadcasting such a transaction prior to this event may lead to our counterparty
670 * trivially stealing all funds in the funding transaction!
672 LDKEvent_FundingBroadcastSafe,
674 * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
675 * ChannelManager::claim_funds to get it....
676 * Note that if the preimage is not known or the amount paid is incorrect, you should call
677 * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
678 * network congestion.
679 * The amount paid should be considered 'incorrect' when it is less than or more than twice
680 * the amount expected.
681 * If you fail to call either ChannelManager::claim_funds or
682 * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
683 * automatically failed.
685 LDKEvent_PaymentReceived,
687 * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
688 * and we got back the payment preimage for it).
689 * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
690 * deduplicate them by payment_preimage (which MUST be unique)!
692 LDKEvent_PaymentSent,
694 * Indicates an outbound payment we made failed. Probably some intermediary node dropped
695 * something. You may wish to retry with a different route.
696 * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
697 * deduplicate them by payment_hash (which MUST be unique)!
699 LDKEvent_PaymentFailed,
701 * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
702 * time in the future.
704 LDKEvent_PendingHTLCsForwardable,
706 * Used to indicate that an output was generated on-chain which you should know how to spend.
707 * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
708 * counterparty spending them due to some kind of timeout. Thus, you need to store them
709 * somewhere and spend them when you create on-chain transactions.
711 LDKEvent_SpendableOutputs,
713 * Must be last for serialization purposes
718 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
719 LDKThirtyTwoBytes temporary_channel_id;
720 uint64_t channel_value_satoshis;
721 LDKCVec_u8Z output_script;
722 uint64_t user_channel_id;
723 } LDKEvent_LDKFundingGenerationReady_Body;
725 typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
726 LDKOutPoint funding_txo;
727 uint64_t user_channel_id;
728 } LDKEvent_LDKFundingBroadcastSafe_Body;
730 typedef struct LDKEvent_LDKPaymentReceived_Body {
731 LDKThirtyTwoBytes payment_hash;
732 LDKThirtyTwoBytes payment_secret;
734 } LDKEvent_LDKPaymentReceived_Body;
736 typedef struct LDKEvent_LDKPaymentSent_Body {
737 LDKThirtyTwoBytes payment_preimage;
738 } LDKEvent_LDKPaymentSent_Body;
740 typedef struct LDKEvent_LDKPaymentFailed_Body {
741 LDKThirtyTwoBytes payment_hash;
742 bool rejected_by_dest;
743 } LDKEvent_LDKPaymentFailed_Body;
745 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
746 uint64_t time_forwardable;
747 } LDKEvent_LDKPendingHTLCsForwardable_Body;
749 typedef struct LDKEvent_LDKSpendableOutputs_Body {
750 LDKCVec_SpendableOutputDescriptorZ outputs;
751 } LDKEvent_LDKSpendableOutputs_Body;
753 typedef struct LDKEvent {
756 LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
757 LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe;
758 LDKEvent_LDKPaymentReceived_Body payment_received;
759 LDKEvent_LDKPaymentSent_Body payment_sent;
760 LDKEvent_LDKPaymentFailed_Body payment_failed;
761 LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
762 LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
769 * An accept_channel message to be sent or received from a peer
771 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
773 * Nearly everyhwere, inner must be non-null, however in places where
774 * the Rust equivalent takes an Option, it may be set to null to indicate None.
776 LDKnativeAcceptChannel *inner;
783 * An open_channel message to be sent or received from a peer
785 typedef struct MUST_USE_STRUCT LDKOpenChannel {
787 * Nearly everyhwere, inner must be non-null, however in places where
788 * the Rust equivalent takes an Option, it may be set to null to indicate None.
790 LDKnativeOpenChannel *inner;
797 * A funding_created message to be sent or received from a peer
799 typedef struct MUST_USE_STRUCT LDKFundingCreated {
801 * Nearly everyhwere, inner must be non-null, however in places where
802 * the Rust equivalent takes an Option, it may be set to null to indicate None.
804 LDKnativeFundingCreated *inner;
811 * A funding_signed message to be sent or received from a peer
813 typedef struct MUST_USE_STRUCT LDKFundingSigned {
815 * Nearly everyhwere, inner must be non-null, however in places where
816 * the Rust equivalent takes an Option, it may be set to null to indicate None.
818 LDKnativeFundingSigned *inner;
825 * A funding_locked message to be sent or received from a peer
827 typedef struct MUST_USE_STRUCT LDKFundingLocked {
829 * Nearly everyhwere, inner must be non-null, however in places where
830 * the Rust equivalent takes an Option, it may be set to null to indicate None.
832 LDKnativeFundingLocked *inner;
839 * An announcement_signatures message to be sent or received from a peer
841 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
843 * Nearly everyhwere, inner must be non-null, however in places where
844 * the Rust equivalent takes an Option, it may be set to null to indicate None.
846 LDKnativeAnnouncementSignatures *inner;
848 } LDKAnnouncementSignatures;
853 * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
854 * transaction updates if they were pending.
856 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
858 * Nearly everyhwere, inner must be non-null, however in places where
859 * the Rust equivalent takes an Option, it may be set to null to indicate None.
861 LDKnativeCommitmentUpdate *inner;
863 } LDKCommitmentUpdate;
868 * A revoke_and_ack message to be sent or received from a peer
870 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
872 * Nearly everyhwere, inner must be non-null, however in places where
873 * the Rust equivalent takes an Option, it may be set to null to indicate None.
875 LDKnativeRevokeAndACK *inner;
882 * A closing_signed message to be sent or received from a peer
884 typedef struct MUST_USE_STRUCT LDKClosingSigned {
886 * Nearly everyhwere, inner must be non-null, however in places where
887 * the Rust equivalent takes an Option, it may be set to null to indicate None.
889 LDKnativeClosingSigned *inner;
896 * A shutdown message to be sent or received from a peer
898 typedef struct MUST_USE_STRUCT LDKShutdown {
900 * Nearly everyhwere, inner must be non-null, however in places where
901 * the Rust equivalent takes an Option, it may be set to null to indicate None.
903 LDKnativeShutdown *inner;
910 * A channel_reestablish message to be sent or received from a peer
912 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
914 * Nearly everyhwere, inner must be non-null, however in places where
915 * the Rust equivalent takes an Option, it may be set to null to indicate None.
917 LDKnativeChannelReestablish *inner;
919 } LDKChannelReestablish;
924 * A node_announcement message to be sent or received from a peer
926 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
928 * Nearly everyhwere, inner must be non-null, however in places where
929 * the Rust equivalent takes an Option, it may be set to null to indicate None.
931 LDKnativeNodeAnnouncement *inner;
933 } LDKNodeAnnouncement;
938 * An error message to be sent or received from a peer
940 typedef struct MUST_USE_STRUCT LDKErrorMessage {
942 * Nearly everyhwere, inner must be non-null, however in places where
943 * the Rust equivalent takes an Option, it may be set to null to indicate None.
945 LDKnativeErrorMessage *inner;
950 * Used to put an error message in a LightningError
952 typedef enum LDKErrorAction_Tag {
954 * The peer took some action which made us think they were useless. Disconnect them.
956 LDKErrorAction_DisconnectPeer,
958 * The peer did something harmless that we weren't able to process, just log and ignore
960 LDKErrorAction_IgnoreError,
962 * The peer did something incorrect. Tell them.
964 LDKErrorAction_SendErrorMessage,
966 * Must be last for serialization purposes
968 LDKErrorAction_Sentinel,
969 } LDKErrorAction_Tag;
971 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
973 } LDKErrorAction_LDKDisconnectPeer_Body;
975 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
977 } LDKErrorAction_LDKSendErrorMessage_Body;
979 typedef struct LDKErrorAction {
980 LDKErrorAction_Tag tag;
982 LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
983 LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
988 * The information we received from a peer along the route of a payment we originated. This is
989 * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
990 * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
992 typedef enum LDKHTLCFailChannelUpdate_Tag {
994 * We received an error which included a full ChannelUpdate message.
996 LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
998 * We received an error which indicated only that a channel has been closed
1000 LDKHTLCFailChannelUpdate_ChannelClosed,
1002 * We received an error which indicated only that a node has failed
1004 LDKHTLCFailChannelUpdate_NodeFailure,
1006 * Must be last for serialization purposes
1008 LDKHTLCFailChannelUpdate_Sentinel,
1009 } LDKHTLCFailChannelUpdate_Tag;
1011 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
1012 LDKChannelUpdate msg;
1013 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
1015 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
1016 uint64_t short_channel_id;
1018 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
1020 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
1021 LDKPublicKey node_id;
1023 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
1025 typedef struct LDKHTLCFailChannelUpdate {
1026 LDKHTLCFailChannelUpdate_Tag tag;
1028 LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
1029 LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
1030 LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
1032 } LDKHTLCFailChannelUpdate;
1035 * An event generated by ChannelManager which indicates a message should be sent to a peer (or
1036 * broadcast to most peers).
1037 * These events are handled by PeerManager::process_events if you are using a PeerManager.
1039 typedef enum LDKMessageSendEvent_Tag {
1041 * Used to indicate that we've accepted a channel open and should send the accept_channel
1042 * message provided to the given peer.
1044 LDKMessageSendEvent_SendAcceptChannel,
1046 * Used to indicate that we've initiated a channel open and should send the open_channel
1047 * message provided to the given peer.
1049 LDKMessageSendEvent_SendOpenChannel,
1051 * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
1053 LDKMessageSendEvent_SendFundingCreated,
1055 * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
1057 LDKMessageSendEvent_SendFundingSigned,
1059 * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
1061 LDKMessageSendEvent_SendFundingLocked,
1063 * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
1065 LDKMessageSendEvent_SendAnnouncementSignatures,
1067 * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
1068 * message should be sent to the peer with the given node_id.
1070 LDKMessageSendEvent_UpdateHTLCs,
1072 * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
1074 LDKMessageSendEvent_SendRevokeAndACK,
1076 * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
1078 LDKMessageSendEvent_SendClosingSigned,
1080 * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
1082 LDKMessageSendEvent_SendShutdown,
1084 * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
1086 LDKMessageSendEvent_SendChannelReestablish,
1088 * Used to indicate that a channel_announcement and channel_update should be broadcast to all
1089 * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
1091 * Note that after doing so, you very likely (unless you did so very recently) want to call
1092 * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
1093 * This ensures that any nodes which see our channel_announcement also have a relevant
1094 * node_announcement, including relevant feature flags which may be important for routing
1097 LDKMessageSendEvent_BroadcastChannelAnnouncement,
1099 * Used to indicate that a node_announcement should be broadcast to all peers.
1101 LDKMessageSendEvent_BroadcastNodeAnnouncement,
1103 * Used to indicate that a channel_update should be broadcast to all peers.
1105 LDKMessageSendEvent_BroadcastChannelUpdate,
1107 * Broadcast an error downstream to be handled
1109 LDKMessageSendEvent_HandleError,
1111 * When a payment fails we may receive updates back from the hop where it failed. In such
1112 * cases this event is generated so that we can inform the network graph of this information.
1114 LDKMessageSendEvent_PaymentFailureNetworkUpdate,
1116 * Must be last for serialization purposes
1118 LDKMessageSendEvent_Sentinel,
1119 } LDKMessageSendEvent_Tag;
1121 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
1122 LDKPublicKey node_id;
1123 LDKAcceptChannel msg;
1124 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
1126 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
1127 LDKPublicKey node_id;
1129 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
1131 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
1132 LDKPublicKey node_id;
1133 LDKFundingCreated msg;
1134 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
1136 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
1137 LDKPublicKey node_id;
1138 LDKFundingSigned msg;
1139 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
1141 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
1142 LDKPublicKey node_id;
1143 LDKFundingLocked msg;
1144 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
1146 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
1147 LDKPublicKey node_id;
1148 LDKAnnouncementSignatures msg;
1149 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
1151 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
1152 LDKPublicKey node_id;
1153 LDKCommitmentUpdate updates;
1154 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
1156 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
1157 LDKPublicKey node_id;
1158 LDKRevokeAndACK msg;
1159 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
1161 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
1162 LDKPublicKey node_id;
1163 LDKClosingSigned msg;
1164 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
1166 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
1167 LDKPublicKey node_id;
1169 } LDKMessageSendEvent_LDKSendShutdown_Body;
1171 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
1172 LDKPublicKey node_id;
1173 LDKChannelReestablish msg;
1174 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
1176 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
1177 LDKChannelAnnouncement msg;
1178 LDKChannelUpdate update_msg;
1179 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
1181 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
1182 LDKNodeAnnouncement msg;
1183 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
1185 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
1186 LDKChannelUpdate msg;
1187 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
1189 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
1190 LDKPublicKey node_id;
1191 LDKErrorAction action;
1192 } LDKMessageSendEvent_LDKHandleError_Body;
1194 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
1195 LDKHTLCFailChannelUpdate update;
1196 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
1198 typedef struct LDKMessageSendEvent {
1199 LDKMessageSendEvent_Tag tag;
1201 LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
1202 LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
1203 LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
1204 LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
1205 LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
1206 LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
1207 LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
1208 LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
1209 LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
1210 LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
1211 LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
1212 LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
1213 LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
1214 LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
1215 LDKMessageSendEvent_LDKHandleError_Body handle_error;
1216 LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
1218 } LDKMessageSendEvent;
1220 typedef struct LDKCVecTempl_MessageSendEvent {
1221 LDKMessageSendEvent *data;
1223 } LDKCVecTempl_MessageSendEvent;
1225 typedef LDKCVecTempl_MessageSendEvent LDKCVec_MessageSendEventZ;
1228 * A trait indicating an object may generate message send events
1230 typedef struct LDKMessageSendEventsProvider {
1233 * Gets the list of pending events which were generated by previous actions, clearing the list
1236 LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
1237 void (*free)(void *this_arg);
1238 } LDKMessageSendEventsProvider;
1240 typedef struct LDKCVecTempl_Event {
1243 } LDKCVecTempl_Event;
1245 typedef LDKCVecTempl_Event LDKCVec_EventZ;
1248 * A trait indicating an object may generate events
1250 typedef struct LDKEventsProvider {
1253 * Gets the list of pending events which were generated by previous actions, clearing the list
1256 LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
1257 void (*free)(void *this_arg);
1258 } LDKEventsProvider;
1261 * A trait encapsulating the operations required of a logger
1263 typedef struct LDKLogger {
1268 void (*log)(const void *this_arg, const char *record);
1269 void (*free)(void *this_arg);
1275 * Configuration we set when applicable.
1277 * Default::default() provides sane defaults.
1279 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
1281 * Nearly everyhwere, inner must be non-null, however in places where
1282 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1284 LDKnativeChannelHandshakeConfig *inner;
1286 } LDKChannelHandshakeConfig;
1291 * Optional channel limits which are applied during channel creation.
1293 * These limits are only applied to our counterparty's limits, not our own.
1295 * Use 0/<type>::max_value() as appropriate to skip checking.
1297 * Provides sane defaults for most configurations.
1299 * Most additional limits are disabled except those with which specify a default in individual
1300 * field documentation. Note that this may result in barely-usable channels, but since they
1301 * are applied mostly only to incoming channels that's not much of a problem.
1303 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
1305 * Nearly everyhwere, inner must be non-null, however in places where
1306 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1308 LDKnativeChannelHandshakeLimits *inner;
1310 } LDKChannelHandshakeLimits;
1315 * Options which apply on a per-channel basis and may change at runtime or based on negotiation
1316 * with our counterparty.
1318 typedef struct MUST_USE_STRUCT LDKChannelConfig {
1320 * Nearly everyhwere, inner must be non-null, however in places where
1321 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1323 LDKnativeChannelConfig *inner;
1327 typedef struct LDKu8slice {
1328 const uint8_t *data;
1335 * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
1337 * Default::default() provides sane defaults for most configurations
1338 * (but currently with 0 relay fees!)
1340 typedef struct MUST_USE_STRUCT LDKUserConfig {
1342 * Nearly everyhwere, inner must be non-null, however in places where
1343 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1345 LDKnativeUserConfig *inner;
1349 typedef union LDKCResultPtr_C2TupleTempl_CVec_u8Z__u64_____ChainError {
1350 LDKC2TupleTempl_CVec_u8Z__u64 *result;
1352 } LDKCResultPtr_C2TupleTempl_CVec_u8Z__u64_____ChainError;
1354 typedef struct LDKCResultTempl_C2TupleTempl_CVec_u8Z__u64_____ChainError {
1355 LDKCResultPtr_C2TupleTempl_CVec_u8Z__u64_____ChainError contents;
1357 } LDKCResultTempl_C2TupleTempl_CVec_u8Z__u64_____ChainError;
1359 typedef LDKCResultTempl_C2TupleTempl_CVec_u8Z__u64_____ChainError LDKCResult_C2Tuple_Scriptu64ZChainErrorZ;
1361 typedef struct LDKCVecTempl_usize {
1364 } LDKCVecTempl_usize;
1366 typedef LDKCVecTempl_usize LDKCVec_usizeZ;
1369 * An interface to request notification of certain scripts as they appear the
1372 * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
1373 * called from inside the library in response to ChainListener events, P2P events, or timer
1376 typedef struct LDKChainWatchInterface {
1379 * Provides a txid/random-scriptPubKey-in-the-tx which much be watched for.
1381 void (*install_watch_tx)(const void *this_arg, const uint8_t (*txid)[32], LDKu8slice script_pub_key);
1383 * Provides an outpoint which must be watched for, providing any transactions which spend the
1386 void (*install_watch_outpoint)(const void *this_arg, LDKC2Tuple_Txidu32Z outpoint, LDKu8slice out_script);
1388 * Indicates that a listener needs to see all transactions.
1390 void (*watch_all_txn)(const void *this_arg);
1392 * Gets the script and value in satoshis for a given unspent transaction output given a
1393 * short_channel_id (aka unspent_tx_output_identier). For BTC/tBTC channels the top three
1394 * bytes are the block height, the next 3 the transaction index within the block, and the
1395 * final two the output within the transaction.
1397 LDKCResult_C2Tuple_Scriptu64ZChainErrorZ (*get_chain_utxo)(const void *this_arg, LDKThirtyTwoBytes genesis_hash, uint64_t unspent_tx_output_identifier);
1399 * Gets the list of transaction indices within a given block that the ChainWatchInterface is
1402 LDKCVec_usizeZ (*filter_block)(const void *this_arg, LDKu8slice block);
1404 * Returns a usize that changes when the ChainWatchInterface's watched data is modified.
1405 * Users of `filter_block` should pre-save a copy of `reentered`'s return value and use it to
1406 * determine whether they need to re-filter a given block.
1408 uintptr_t (*reentered)(const void *this_arg);
1409 void (*free)(void *this_arg);
1410 } LDKChainWatchInterface;
1413 * A reference to a serialized transaction, in (pointer, length) form.
1414 * This type does *not* own its own memory, so access to it after, eg, the call in which it was
1415 * provided to you are invalid.
1417 typedef struct LDKTransaction {
1418 const uint8_t *data;
1423 * An interface to send a transaction to the Bitcoin network.
1425 typedef struct LDKBroadcasterInterface {
1428 * Sends a transaction out to (hopefully) be mined.
1430 void (*broadcast_transaction)(const void *this_arg, LDKTransaction tx);
1431 void (*free)(void *this_arg);
1432 } LDKBroadcasterInterface;
1434 typedef struct LDKCVecTempl_CVec_u8Z {
1437 } LDKCVecTempl_CVec_u8Z;
1439 typedef LDKCVecTempl_CVec_u8Z LDKCVec_TransactionZ;
1441 typedef struct LDKusizeslice {
1442 const uintptr_t *data;
1447 * A trait indicating a desire to listen for events from the chain
1449 typedef struct LDKChainListener {
1452 * Notifies a listener that a block was connected.
1454 * The txn_matched array should be set to references to transactions which matched the
1455 * relevant installed watch outpoints/txn, or the full set of transactions in the block.
1457 * Note that if txn_matched includes only matched transactions, and a new
1458 * transaction/outpoint is watched during a block_connected call, the block *must* be
1459 * re-scanned with the new transaction/outpoints and block_connected should be called
1460 * again with the same header and (at least) the new transactions.
1462 * Note that if non-new transaction/outpoints are be registered during a call, a second call
1463 * *must not* happen.
1465 * This also means those counting confirmations using block_connected callbacks should watch
1466 * for duplicate headers and not count them towards confirmations!
1468 void (*block_connected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height, LDKCVec_TransactionZ txn_matched, LDKusizeslice indexes_of_txn_matched);
1470 * Notifies a listener that a block was disconnected.
1471 * Unlike block_connected, this *must* never be called twice for the same disconnect event.
1472 * Height must be the one of the block which was disconnected (not new height of the best chain)
1474 void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
1475 void (*free)(void *this_arg);
1479 * A trait which should be implemented to provide feerate information on a number of time
1482 * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
1483 * called from inside the library in response to ChainListener events, P2P events, or timer
1486 typedef struct LDKFeeEstimator {
1489 * Gets estimated satoshis of fee required per 1000 Weight-Units.
1491 * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
1492 * don't put us below 1 satoshi-per-byte).
1494 * This translates to:
1495 * * satoshis-per-byte * 250
1496 * * ceil(satoshis-per-kbyte / 4)
1498 uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, LDKConfirmationTarget confirmation_target);
1499 void (*free)(void *this_arg);
1505 * Utility for tracking registered txn/outpoints and checking for matches
1507 typedef struct MUST_USE_STRUCT LDKChainWatchedUtil {
1509 * Nearly everyhwere, inner must be non-null, however in places where
1510 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1512 LDKnativeChainWatchedUtil *inner;
1514 } LDKChainWatchedUtil;
1519 * Utility for notifying listeners about new blocks, and handling block rescans if new watch
1520 * data is registered.
1522 * Rather than using a plain BlockNotifier, it is preferable to use either a BlockNotifierArc
1523 * or a BlockNotifierRef for conciseness. See their documentation for more details, but essentially
1524 * you should default to using a BlockNotifierRef, and use a BlockNotifierArc instead when you
1525 * require ChainListeners with static lifetimes, such as when you're using lightning-net-tokio.
1527 typedef struct MUST_USE_STRUCT LDKBlockNotifier {
1529 * Nearly everyhwere, inner must be non-null, however in places where
1530 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1532 LDKnativeBlockNotifier *inner;
1539 * Utility to capture some common parts of ChainWatchInterface implementors.
1541 * Keeping a local copy of this in a ChainWatchInterface implementor is likely useful.
1543 typedef struct MUST_USE_STRUCT LDKChainWatchInterfaceUtil {
1545 * Nearly everyhwere, inner must be non-null, however in places where
1546 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1548 LDKnativeChainWatchInterfaceUtil *inner;
1550 } LDKChainWatchInterfaceUtil;
1555 * One counterparty's public keys which do not change over the life of a channel.
1557 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
1559 * Nearly everyhwere, inner must be non-null, however in places where
1560 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1562 LDKnativeChannelPublicKeys *inner;
1564 } LDKChannelPublicKeys;
1569 * The per-commitment point and a set of pre-calculated public keys used for transaction creation
1571 * The pre-calculated keys are an optimization, because ChannelKeys has enough
1572 * information to re-derive them.
1574 typedef struct MUST_USE_STRUCT LDKPreCalculatedTxCreationKeys {
1576 * Nearly everyhwere, inner must be non-null, however in places where
1577 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1579 LDKnativePreCalculatedTxCreationKeys *inner;
1581 } LDKPreCalculatedTxCreationKeys;
1583 typedef struct LDKCVecTempl_HTLCOutputInCommitment {
1584 LDKHTLCOutputInCommitment *data;
1586 } LDKCVecTempl_HTLCOutputInCommitment;
1588 typedef LDKCVecTempl_HTLCOutputInCommitment LDKCVec_HTLCOutputInCommitmentZ;
1593 * We use this to track holder commitment transactions and put off signing them until we are ready
1594 * to broadcast. This class can be used inside a signer implementation to generate a signature
1595 * given the relevant secret key.
1597 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1599 * Nearly everyhwere, inner must be non-null, however in places where
1600 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1602 LDKnativeHolderCommitmentTransaction *inner;
1604 } LDKHolderCommitmentTransaction;
1609 * The unsigned part of a channel_announcement
1611 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
1613 * Nearly everyhwere, inner must be non-null, however in places where
1614 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1616 LDKnativeUnsignedChannelAnnouncement *inner;
1618 } LDKUnsignedChannelAnnouncement;
1621 * Set of lightning keys needed to operate a channel as described in BOLT 3.
1623 * Signing services could be implemented on a hardware wallet. In this case,
1624 * the current ChannelKeys would be a front-end on top of a communication
1625 * channel connected to your secure device and lightning key material wouldn't
1626 * reside on a hot server. Nevertheless, a this deployment would still need
1627 * to trust the ChannelManager to avoid loss of funds as this latest component
1628 * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
1630 * A more secure iteration would be to use hashlock (or payment points) to pair
1631 * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
1632 * at the price of more state and computation on the hardware wallet side. In the future,
1633 * we are looking forward to design such interface.
1635 * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
1636 * to act, as liveness and breach reply correctness are always going to be hard requirements
1637 * of LN security model, orthogonal of key management issues.
1639 * If you're implementing a custom signer, you almost certainly want to implement
1640 * Readable/Writable to serialize out a unique reference to this set of keys so
1641 * that you can serialize the full ChannelManager object.
1644 typedef struct LDKChannelKeys {
1647 * Gets the per-commitment point for a specific commitment number
1649 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1651 LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
1653 * Gets the commitment secret for a specific commitment number as part of the revocation process
1655 * An external signer implementation should error here if the commitment was already signed
1656 * and should refuse to sign it in the future.
1658 * May be called more than once for the same index.
1660 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1661 * TODO: return a Result so we can signal a validation error
1663 LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
1665 * Gets the holder's channel public keys and basepoints
1667 LDKChannelPublicKeys pubkeys;
1669 * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
1670 * Note that this takes a pointer to this object, not the this_ptr like other methods do
1671 * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
1673 void (*set_pubkeys)(const LDKChannelKeys*);
1675 * Gets arbitrary identifiers describing the set of keys which are provided back to you in
1676 * some SpendableOutputDescriptor types. These should be sufficient to identify this
1677 * ChannelKeys object uniquely and lookup or re-derive its keys.
1679 LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
1681 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
1683 * Note that if signing fails or is rejected, the channel will be force-closed.
1685 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);
1687 * Create a signature for a holder's commitment transaction. This will only ever be called with
1688 * the same holder_commitment_tx (or a copy thereof), though there are currently no guarantees
1689 * that it will not be called multiple times.
1690 * An external signer implementation should check that the commitment has not been revoked.
1692 LDKCResult_SignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx);
1694 * Create a signature for each HTLC transaction spending a holder's commitment transaction.
1696 * Unlike sign_holder_commitment, this may be called multiple times with *different*
1697 * holder_commitment_tx values. While this will never be called with a revoked
1698 * holder_commitment_tx, it is possible that it is called with the second-latest
1699 * holder_commitment_tx (only if we haven't yet revoked it) if some watchtower/secondary
1700 * ChannelMonitor decided to broadcast before it had been updated to the latest.
1702 * Either an Err should be returned, or a Vec with one entry for each HTLC which exists in
1703 * holder_commitment_tx. For those HTLCs which have transaction_output_index set to None
1704 * (implying they were considered dust at the time the commitment transaction was negotiated),
1705 * a corresponding None should be included in the return value. All other positions in the
1706 * return value must contain a signature.
1708 LDKCResult_CVec_SignatureZNoneZ (*sign_holder_commitment_htlc_transactions)(const void *this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx);
1710 * Create a signature for the given input in a transaction spending an HTLC or commitment
1711 * transaction output when our counterparty broadcasts an old state.
1713 * A justice transaction may claim multiples outputs at the same time if timelocks are
1714 * similar, but only a signature for the input at index `input` should be signed for here.
1715 * It may be called multiples time for same output(s) if a fee-bump is needed with regards
1716 * to an upcoming timelock expiration.
1718 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1720 * per_commitment_key is revocation secret which was provided by our counterparty when they
1721 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
1722 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
1725 * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
1726 * changing the format of the witness script (which is committed to in the BIP 143
1729 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);
1731 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
1732 * transaction, either offered or received.
1734 * Such a transaction may claim multiples offered outputs at same time if we know the
1735 * preimage for each when we create it, but only the input at index `input` should be
1736 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
1737 * needed with regards to an upcoming timelock expiration.
1739 * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
1742 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1744 * Per_commitment_point is the dynamic point corresponding to the channel state
1745 * detected onchain. It has been generated by our counterparty and is used to derive
1746 * channel state keys, which are then included in the witness script and committed to in the
1747 * BIP 143 signature.
1749 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);
1751 * Create a signature for a (proposed) closing transaction.
1753 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
1754 * chosen to forgo their output as dust.
1756 LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, LDKTransaction closing_tx);
1758 * Signs a channel announcement message with our funding key, proving it comes from one
1759 * of the channel participants.
1761 * Note that if this fails or is rejected, the channel will not be publicly announced and
1762 * our counterparty may (though likely will not) close the channel on us for violating the
1765 LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const LDKUnsignedChannelAnnouncement *msg);
1767 * Set the counterparty channel basepoints and counterparty_selected/holder_selected_contest_delay.
1768 * This is done immediately on incoming channels and as soon as the channel is accepted on outgoing channels.
1770 * We bind holder_selected_contest_delay late here for API convenience.
1772 * Will be called before any signatures are applied.
1774 void (*on_accept)(void *this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay);
1775 void *(*clone)(const void *this_arg);
1776 void (*free)(void *this_arg);
1779 typedef struct LDKSecretKey {
1784 * A trait to describe an object which can get user secrets and key material.
1786 typedef struct LDKKeysInterface {
1789 * Get node secret key (aka node_id or network_key)
1791 LDKSecretKey (*get_node_secret)(const void *this_arg);
1793 * Get destination redeemScript to encumber static protocol exit points.
1795 LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
1797 * Get shutdown_pubkey to use as PublicKey at channel closure
1799 LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
1801 * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
1802 * restarted with some stale data!
1804 LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
1806 * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
1807 * onion packets and for temporary channel IDs. There is no requirement that these be
1808 * persisted anywhere, though they must be unique across restarts.
1810 LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
1811 void (*free)(void *this_arg);
1817 * A simple implementation of ChannelKeys that just keeps the private keys in memory.
1819 typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
1821 * Nearly everyhwere, inner must be non-null, however in places where
1822 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1824 LDKnativeInMemoryChannelKeys *inner;
1826 } LDKInMemoryChannelKeys;
1831 * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
1832 * and derives keys from that.
1834 * Your node_id is seed/0'
1835 * ChannelMonitor closes may use seed/1'
1836 * Cooperative closes may use seed/2'
1837 * The two close keys may be needed to claim on-chain funds!
1839 typedef struct MUST_USE_STRUCT LDKKeysManager {
1841 * Nearly everyhwere, inner must be non-null, however in places where
1842 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1844 LDKnativeKeysManager *inner;
1851 * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
1852 * on-chain transactions to ensure no loss of funds occurs.
1854 * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
1855 * information and are actively monitoring the chain.
1857 * Pending Events or updated HTLCs which have not yet been read out by
1858 * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
1859 * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
1860 * gotten are fully handled before re-serializing the new state.
1862 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
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 LDKnativeChannelMonitor *inner;
1869 } LDKChannelMonitor;
1874 * An update generated by the underlying Channel itself which contains some new information the
1875 * ChannelMonitor should be made aware of.
1877 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1879 * Nearly everyhwere, inner must be non-null, however in places where
1880 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1882 LDKnativeChannelMonitorUpdate *inner;
1884 } LDKChannelMonitorUpdate;
1889 * An event to be processed by the ChannelManager.
1891 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1893 * Nearly everyhwere, inner must be non-null, however in places where
1894 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1896 LDKnativeMonitorEvent *inner;
1900 typedef struct LDKCVecTempl_MonitorEvent {
1901 LDKMonitorEvent *data;
1903 } LDKCVecTempl_MonitorEvent;
1905 typedef LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ;
1908 * Simple trait indicating ability to track a set of ChannelMonitors and multiplex events between
1909 * them. Generally should be implemented by keeping a local SimpleManyChannelMonitor and passing
1910 * events to it, while also taking any add/update_monitor events and passing them to some remote
1913 * In general, you must always have at least one local copy in memory, which must never fail to
1914 * update (as it is responsible for broadcasting the latest state in case the channel is closed),
1915 * and then persist it to various on-disk locations. If, for some reason, the in-memory copy fails
1916 * to update (eg out-of-memory or some other condition), you must immediately shut down without
1917 * taking any further action such as writing the current state to disk. This should likely be
1918 * accomplished via panic!() or abort().
1920 * Note that any updates to a channel's monitor *must* be applied to each instance of the
1921 * channel's monitor everywhere (including remote watchtowers) *before* this function returns. If
1922 * an update occurs and a remote watchtower is left with old state, it may broadcast transactions
1923 * which we have revoked, allowing our counterparty to claim all funds in the channel!
1925 * User needs to notify implementors of ManyChannelMonitor when a new block is connected or
1926 * disconnected using their `block_connected` and `block_disconnected` methods. However, rather
1927 * than calling these methods directly, the user should register implementors as listeners to the
1928 * BlockNotifier and call the BlockNotifier's `block_(dis)connected` methods, which will notify
1929 * all registered listeners in one go.
1931 typedef struct LDKManyChannelMonitor {
1934 * Adds a monitor for the given `funding_txo`.
1936 * Implementer must also ensure that the funding_txo txid *and* outpoint are registered with
1937 * any relevant ChainWatchInterfaces such that the provided monitor receives block_connected
1938 * callbacks with the funding transaction, or any spends of it.
1940 * Further, the implementer must also ensure that each output returned in
1941 * monitor.get_outputs_to_watch() is registered to ensure that the provided monitor learns about
1942 * any spends of any of the outputs.
1944 * Any spends of outputs which should have been registered which aren't passed to
1945 * ChannelMonitors via block_connected may result in FUNDS LOSS.
1947 LDKCResult_NoneChannelMonitorUpdateErrZ (*add_monitor)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor);
1949 * Updates a monitor for the given `funding_txo`.
1951 * Implementer must also ensure that the funding_txo txid *and* outpoint are registered with
1952 * any relevant ChainWatchInterfaces such that the provided monitor receives block_connected
1953 * callbacks with the funding transaction, or any spends of it.
1955 * Further, the implementer must also ensure that each output returned in
1956 * monitor.get_watch_outputs() is registered to ensure that the provided monitor learns about
1957 * any spends of any of the outputs.
1959 * Any spends of outputs which should have been registered which aren't passed to
1960 * ChannelMonitors via block_connected may result in FUNDS LOSS.
1962 * In case of distributed watchtowers deployment, even if an Err is return, the new version
1963 * must be written to disk, as state may have been stored but rejected due to a block forcing
1964 * a commitment broadcast. This storage is used to claim outputs of rejected state confirmed
1965 * onchain by another watchtower, lagging behind on block processing.
1967 LDKCResult_NoneChannelMonitorUpdateErrZ (*update_monitor)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate monitor);
1969 * Used by ChannelManager to get list of HTLC resolved onchain and which needed to be updated
1970 * with success or failure.
1972 * You should probably just call through to
1973 * ChannelMonitor::get_and_clear_pending_monitor_events() for each ChannelMonitor and return
1976 LDKCVec_MonitorEventZ (*get_and_clear_pending_monitor_events)(const void *this_arg);
1977 void (*free)(void *this_arg);
1978 } LDKManyChannelMonitor;
1983 * Manager which keeps track of a number of channels and sends messages to the appropriate
1984 * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
1986 * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
1987 * to individual Channels.
1989 * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
1990 * all peers during write/read (though does not modify this instance, only the instance being
1991 * serialized). This will result in any channels which have not yet exchanged funding_created (ie
1992 * called funding_transaction_generated for outbound channels).
1994 * Note that you can be a bit lazier about writing out ChannelManager than you can be with
1995 * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
1996 * returning from ManyChannelMonitor::add_/update_monitor, with ChannelManagers, writing updates
1997 * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
1998 * the serialization process). If the deserialized version is out-of-date compared to the
1999 * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
2000 * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
2002 * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which
2003 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
2004 * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
2005 * block_connected() to step towards your best block) upon deserialization before using the
2008 * Note that ChannelManager is responsible for tracking liveness of its channels and generating
2009 * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
2010 * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
2011 * offline for a full minute. In order to track this, you must call
2012 * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect.
2014 * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
2015 * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
2016 * essentially you should default to using a SimpleRefChannelManager, and use a
2017 * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
2018 * you're using lightning-net-tokio.
2020 typedef struct MUST_USE_STRUCT LDKChannelManager {
2022 * Nearly everyhwere, inner must be non-null, however in places where
2023 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2025 LDKnativeChannelManager *inner;
2027 } LDKChannelManager;
2032 * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2034 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2036 * Nearly everyhwere, inner must be non-null, however in places where
2037 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2039 LDKnativeChannelDetails *inner;
2041 } LDKChannelDetails;
2046 * Features used within an `init` message.
2048 typedef struct MUST_USE_STRUCT LDKInitFeatures {
2050 * Nearly everyhwere, inner must be non-null, however in places where
2051 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2053 LDKnativeInitFeatures *inner;
2057 typedef struct LDKCVecTempl_ChannelDetails {
2058 LDKChannelDetails *data;
2060 } LDKCVecTempl_ChannelDetails;
2062 typedef LDKCVecTempl_ChannelDetails LDKCVec_ChannelDetailsZ;
2067 * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2068 * it can take multiple paths. Each path is composed of one or more hops through the network.
2070 typedef struct MUST_USE_STRUCT LDKRoute {
2072 * Nearly everyhwere, inner must be non-null, however in places where
2073 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2075 LDKnativeRoute *inner;
2079 typedef struct LDKThreeBytes {
2083 typedef struct LDKFourBytes {
2087 typedef struct LDKSixteenBytes {
2091 typedef struct LDKTenBytes {
2096 * An address which can be used to connect to a remote peer
2098 typedef enum LDKNetAddress_Tag {
2100 * An IPv4 address/port on which the peer is listening.
2104 * An IPv6 address/port on which the peer is listening.
2108 * An old-style Tor onion address/port on which the peer is listening.
2110 LDKNetAddress_OnionV2,
2112 * A new-style Tor onion address/port on which the peer is listening.
2113 * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
2114 * wrap as base32 and append \".onion\".
2116 LDKNetAddress_OnionV3,
2118 * Must be last for serialization purposes
2120 LDKNetAddress_Sentinel,
2121 } LDKNetAddress_Tag;
2123 typedef struct LDKNetAddress_LDKIPv4_Body {
2126 } LDKNetAddress_LDKIPv4_Body;
2128 typedef struct LDKNetAddress_LDKIPv6_Body {
2129 LDKSixteenBytes addr;
2131 } LDKNetAddress_LDKIPv6_Body;
2133 typedef struct LDKNetAddress_LDKOnionV2_Body {
2136 } LDKNetAddress_LDKOnionV2_Body;
2138 typedef struct LDKNetAddress_LDKOnionV3_Body {
2139 LDKThirtyTwoBytes ed25519_pubkey;
2143 } LDKNetAddress_LDKOnionV3_Body;
2145 typedef struct LDKNetAddress {
2146 LDKNetAddress_Tag tag;
2148 LDKNetAddress_LDKIPv4_Body i_pv4;
2149 LDKNetAddress_LDKIPv6_Body i_pv6;
2150 LDKNetAddress_LDKOnionV2_Body onion_v2;
2151 LDKNetAddress_LDKOnionV3_Body onion_v3;
2155 typedef struct LDKCVecTempl_NetAddress {
2156 LDKNetAddress *data;
2158 } LDKCVecTempl_NetAddress;
2160 typedef LDKCVecTempl_NetAddress LDKCVec_NetAddressZ;
2165 * An update_add_htlc message to be sent or received from a peer
2167 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
2169 * Nearly everyhwere, inner must be non-null, however in places where
2170 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2172 LDKnativeUpdateAddHTLC *inner;
2179 * An update_fulfill_htlc message to be sent or received from a peer
2181 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
2183 * Nearly everyhwere, inner must be non-null, however in places where
2184 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2186 LDKnativeUpdateFulfillHTLC *inner;
2188 } LDKUpdateFulfillHTLC;
2193 * An update_fail_htlc message to be sent or received from a peer
2195 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
2197 * Nearly everyhwere, inner must be non-null, however in places where
2198 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2200 LDKnativeUpdateFailHTLC *inner;
2202 } LDKUpdateFailHTLC;
2207 * An update_fail_malformed_htlc message to be sent or received from a peer
2209 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
2211 * Nearly everyhwere, inner must be non-null, however in places where
2212 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2214 LDKnativeUpdateFailMalformedHTLC *inner;
2216 } LDKUpdateFailMalformedHTLC;
2221 * A commitment_signed message to be sent or received from a peer
2223 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
2225 * Nearly everyhwere, inner must be non-null, however in places where
2226 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2228 LDKnativeCommitmentSigned *inner;
2230 } LDKCommitmentSigned;
2235 * An update_fee message to be sent or received from a peer
2237 typedef struct MUST_USE_STRUCT LDKUpdateFee {
2239 * Nearly everyhwere, inner must be non-null, however in places where
2240 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2242 LDKnativeUpdateFee *inner;
2249 * An init message to be sent or received from a peer
2251 typedef struct MUST_USE_STRUCT LDKInit {
2253 * Nearly everyhwere, inner must be non-null, however in places where
2254 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2256 LDKnativeInit *inner;
2261 * A trait to describe an object which can receive channel messages.
2263 * Messages MAY be called in parallel when they originate from different their_node_ids, however
2264 * they MUST NOT be called in parallel when the two calls have the same their_node_id.
2266 typedef struct LDKChannelMessageHandler {
2269 * Handle an incoming open_channel message from the given peer.
2271 void (*handle_open_channel)(const void *this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg);
2273 * Handle an incoming accept_channel message from the given peer.
2275 void (*handle_accept_channel)(const void *this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg);
2277 * Handle an incoming funding_created message from the given peer.
2279 void (*handle_funding_created)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg);
2281 * Handle an incoming funding_signed message from the given peer.
2283 void (*handle_funding_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg);
2285 * Handle an incoming funding_locked message from the given peer.
2287 void (*handle_funding_locked)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg);
2289 * Handle an incoming shutdown message from the given peer.
2291 void (*handle_shutdown)(const void *this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg);
2293 * Handle an incoming closing_signed message from the given peer.
2295 void (*handle_closing_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg);
2297 * Handle an incoming update_add_htlc message from the given peer.
2299 void (*handle_update_add_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg);
2301 * Handle an incoming update_fulfill_htlc message from the given peer.
2303 void (*handle_update_fulfill_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg);
2305 * Handle an incoming update_fail_htlc message from the given peer.
2307 void (*handle_update_fail_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg);
2309 * Handle an incoming update_fail_malformed_htlc message from the given peer.
2311 void (*handle_update_fail_malformed_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg);
2313 * Handle an incoming commitment_signed message from the given peer.
2315 void (*handle_commitment_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg);
2317 * Handle an incoming revoke_and_ack message from the given peer.
2319 void (*handle_revoke_and_ack)(const void *this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg);
2321 * Handle an incoming update_fee message from the given peer.
2323 void (*handle_update_fee)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg);
2325 * Handle an incoming announcement_signatures message from the given peer.
2327 void (*handle_announcement_signatures)(const void *this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg);
2329 * Indicates a connection to the peer failed/an existing connection was lost. If no connection
2330 * is believed to be possible in the future (eg they're sending us messages we don't
2331 * understand or indicate they require unknown feature bits), no_connection_possible is set
2332 * and any outstanding channels should be failed.
2334 void (*peer_disconnected)(const void *this_arg, LDKPublicKey their_node_id, bool no_connection_possible);
2336 * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
2338 void (*peer_connected)(const void *this_arg, LDKPublicKey their_node_id, const LDKInit *msg);
2340 * Handle an incoming channel_reestablish message from the given peer.
2342 void (*handle_channel_reestablish)(const void *this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg);
2344 * Handle an incoming error message from the given peer.
2346 void (*handle_error)(const void *this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg);
2347 LDKMessageSendEventsProvider MessageSendEventsProvider;
2348 void (*free)(void *this_arg);
2349 } LDKChannelMessageHandler;
2354 * Arguments for the creation of a ChannelManager that are not deserialized.
2356 * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
2358 * 1) Deserialize all stored ChannelMonitors.
2359 * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash,
2360 * ChannelManager)>::read(reader, args).
2361 * This may result in closing some Channels if the ChannelMonitor is newer than the stored
2362 * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
2363 * 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
2364 * ChannelMonitor::get_monitored_outpoints and ChannelMonitor::get_funding_txo().
2365 * 4) Reconnect blocks on your ChannelMonitors.
2366 * 5) Move the ChannelMonitors into your local ManyChannelMonitor.
2367 * 6) Disconnect/connect blocks on the ChannelManager.
2368 * 7) Register the new ChannelManager with your ChainWatchInterface.
2370 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
2372 * Nearly everyhwere, inner must be non-null, however in places where
2373 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2375 LDKnativeChannelManagerReadArgs *inner;
2377 } LDKChannelManagerReadArgs;
2379 typedef struct LDKCVecTempl_ChannelMonitor {
2380 LDKChannelMonitor *data;
2382 } LDKCVecTempl_ChannelMonitor;
2384 typedef LDKCVecTempl_ChannelMonitor LDKCVec_ChannelMonitorZ;
2389 * Simple structure send back by ManyChannelMonitor in case of HTLC detected onchain from a
2390 * forward channel and from which info are needed to update HTLC in a backward channel.
2392 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
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 LDKnativeHTLCUpdate *inner;
2404 * An error in decoding a message or struct.
2406 typedef struct MUST_USE_STRUCT LDKDecodeError {
2408 * Nearly everyhwere, inner must be non-null, however in places where
2409 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2411 LDKnativeDecodeError *inner;
2418 * A ping message to be sent or received from a peer
2420 typedef struct MUST_USE_STRUCT LDKPing {
2422 * Nearly everyhwere, inner must be non-null, however in places where
2423 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2425 LDKnativePing *inner;
2432 * A pong message to be sent or received from a peer
2434 typedef struct MUST_USE_STRUCT LDKPong {
2436 * Nearly everyhwere, inner must be non-null, however in places where
2437 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2439 LDKnativePong *inner;
2446 * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
2447 * This is used to convince the recipient that the channel is at a certain commitment
2448 * number even if they lost that data due to a local failure. Of course, the peer may lie
2449 * and even later commitments may have been revoked.
2451 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
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 LDKnativeDataLossProtect *inner;
2458 } LDKDataLossProtect;
2463 * The unsigned part of a node_announcement
2465 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
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 LDKnativeUnsignedNodeAnnouncement *inner;
2472 } LDKUnsignedNodeAnnouncement;
2477 * The unsigned part of a channel_update
2479 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
2481 * Nearly everyhwere, inner must be non-null, however in places where
2482 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2484 LDKnativeUnsignedChannelUpdate *inner;
2486 } LDKUnsignedChannelUpdate;
2491 * A query_channel_range message is used to query a peer for channel
2492 * UTXOs in a range of blocks. The recipient of a query makes a best
2493 * effort to reply to the query using one or more reply_channel_range
2496 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
2498 * Nearly everyhwere, inner must be non-null, however in places where
2499 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2501 LDKnativeQueryChannelRange *inner;
2503 } LDKQueryChannelRange;
2508 * A reply_channel_range message is a reply to a query_channel_range
2509 * message. Multiple reply_channel_range messages can be sent in reply
2510 * to a single query_channel_range message. The query recipient makes a
2511 * best effort to respond based on their local network view which may
2512 * not be a perfect view of the network. The short_channel_ids in the
2513 * reply are encoded. We only support encoding_type=0 uncompressed
2514 * serialization and do not support encoding_type=1 zlib serialization.
2516 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2518 * Nearly everyhwere, inner must be non-null, however in places where
2519 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2521 LDKnativeReplyChannelRange *inner;
2523 } LDKReplyChannelRange;
2525 typedef struct LDKCVecTempl_u64 {
2530 typedef LDKCVecTempl_u64 LDKCVec_u64Z;
2535 * A query_short_channel_ids message is used to query a peer for
2536 * routing gossip messages related to one or more short_channel_ids.
2537 * The query recipient will reply with the latest, if available,
2538 * channel_announcement, channel_update and node_announcement messages
2539 * it maintains for the requested short_channel_ids followed by a
2540 * reply_short_channel_ids_end message. The short_channel_ids sent in
2541 * this query are encoded. We only support encoding_type=0 uncompressed
2542 * serialization and do not support encoding_type=1 zlib serialization.
2544 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
2546 * Nearly everyhwere, inner must be non-null, however in places where
2547 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2549 LDKnativeQueryShortChannelIds *inner;
2551 } LDKQueryShortChannelIds;
2556 * A reply_short_channel_ids_end message is sent as a reply to a
2557 * query_short_channel_ids message. The query recipient makes a best
2558 * effort to respond based on their local network view which may not be
2559 * a perfect view of the network.
2561 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
2563 * Nearly everyhwere, inner must be non-null, however in places where
2564 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2566 LDKnativeReplyShortChannelIdsEnd *inner;
2568 } LDKReplyShortChannelIdsEnd;
2573 * A gossip_timestamp_filter message is used by a node to request
2574 * gossip relay for messages in the requested time range when the
2575 * gossip_queries feature has been negotiated.
2577 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
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 LDKnativeGossipTimestampFilter *inner;
2584 } LDKGossipTimestampFilter;
2589 * An Err type for failure to process messages.
2591 typedef struct MUST_USE_STRUCT LDKLightningError {
2593 * Nearly everyhwere, inner must be non-null, however in places where
2594 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2596 LDKnativeLightningError *inner;
2598 } LDKLightningError;
2600 typedef struct LDKCVecTempl_UpdateAddHTLC {
2601 LDKUpdateAddHTLC *data;
2603 } LDKCVecTempl_UpdateAddHTLC;
2605 typedef LDKCVecTempl_UpdateAddHTLC LDKCVec_UpdateAddHTLCZ;
2607 typedef struct LDKCVecTempl_UpdateFulfillHTLC {
2608 LDKUpdateFulfillHTLC *data;
2610 } LDKCVecTempl_UpdateFulfillHTLC;
2612 typedef LDKCVecTempl_UpdateFulfillHTLC LDKCVec_UpdateFulfillHTLCZ;
2614 typedef struct LDKCVecTempl_UpdateFailHTLC {
2615 LDKUpdateFailHTLC *data;
2617 } LDKCVecTempl_UpdateFailHTLC;
2619 typedef LDKCVecTempl_UpdateFailHTLC LDKCVec_UpdateFailHTLCZ;
2621 typedef struct LDKCVecTempl_UpdateFailMalformedHTLC {
2622 LDKUpdateFailMalformedHTLC *data;
2624 } LDKCVecTempl_UpdateFailMalformedHTLC;
2626 typedef LDKCVecTempl_UpdateFailMalformedHTLC LDKCVec_UpdateFailMalformedHTLCZ;
2628 typedef union LDKCResultPtr_bool__LightningError {
2630 LDKLightningError *err;
2631 } LDKCResultPtr_bool__LightningError;
2633 typedef struct LDKCResultTempl_bool__LightningError {
2634 LDKCResultPtr_bool__LightningError contents;
2636 } LDKCResultTempl_bool__LightningError;
2638 typedef LDKCResultTempl_bool__LightningError LDKCResult_boolLightningErrorZ;
2640 typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
2641 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *data;
2643 } LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
2645 typedef LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
2647 typedef struct LDKCVecTempl_NodeAnnouncement {
2648 LDKNodeAnnouncement *data;
2650 } LDKCVecTempl_NodeAnnouncement;
2652 typedef LDKCVecTempl_NodeAnnouncement LDKCVec_NodeAnnouncementZ;
2655 * A trait to describe an object which can receive routing messages.
2657 typedef struct LDKRoutingMessageHandler {
2660 * Handle an incoming node_announcement message, returning true if it should be forwarded on,
2661 * false or returning an Err otherwise.
2663 LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const LDKNodeAnnouncement *msg);
2665 * Handle a channel_announcement message, returning true if it should be forwarded on, false
2666 * or returning an Err otherwise.
2668 LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const LDKChannelAnnouncement *msg);
2670 * Handle an incoming channel_update message, returning true if it should be forwarded on,
2671 * false or returning an Err otherwise.
2673 LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const LDKChannelUpdate *msg);
2675 * Handle some updates to the route graph that we learned due to an outbound failed payment.
2677 void (*handle_htlc_fail_channel_update)(const void *this_arg, const LDKHTLCFailChannelUpdate *update);
2679 * Gets a subset of the channel announcements and updates required to dump our routing table
2680 * to a remote node, starting at the short_channel_id indicated by starting_point and
2681 * including the batch_amount entries immediately higher in numerical value than starting_point.
2683 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
2685 * Gets a subset of the node announcements required to dump our routing table to a remote node,
2686 * starting at the node *after* the provided publickey and including batch_amount entries
2687 * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
2688 * If None is provided for starting_point, we start at the first node.
2690 LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, LDKPublicKey starting_point, uint8_t batch_amount);
2692 * Returns whether a full sync should be requested from a peer.
2694 bool (*should_request_full_sync)(const void *this_arg, LDKPublicKey node_id);
2695 void (*free)(void *this_arg);
2696 } LDKRoutingMessageHandler;
2701 * Provides references to trait impls which handle different types of messages.
2703 typedef struct MUST_USE_STRUCT LDKMessageHandler {
2705 * Nearly everyhwere, inner must be non-null, however in places where
2706 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2708 LDKnativeMessageHandler *inner;
2710 } LDKMessageHandler;
2713 * Provides an object which can be used to send data to and which uniquely identifies a connection
2714 * to a remote host. You will need to be able to generate multiple of these which meet Eq and
2715 * implement Hash to meet the PeerManager API.
2717 * For efficiency, Clone should be relatively cheap for this type.
2719 * You probably want to just extend an int and put a file descriptor in a struct and implement
2720 * send_data. Note that if you are using a higher-level net library that may call close() itself,
2721 * be careful to ensure you don't have races whereby you might register a new connection with an
2722 * fd which is the same as a previous one which has yet to be removed via
2723 * PeerManager::socket_disconnected().
2725 typedef struct LDKSocketDescriptor {
2728 * Attempts to send some data from the given slice to the peer.
2730 * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
2731 * Note that in the disconnected case, socket_disconnected must still fire and further write
2732 * attempts may occur until that time.
2734 * If the returned size is smaller than data.len(), a write_available event must
2735 * trigger the next time more data can be written. Additionally, until the a send_data event
2736 * completes fully, no further read_events should trigger on the same peer!
2738 * If a read_event on this descriptor had previously returned true (indicating that read
2739 * events should be paused to prevent DoS in the send buffer), resume_read may be set
2740 * indicating that read events on this descriptor should resume. A resume_read of false does
2741 * *not* imply that further read events should be paused.
2743 uintptr_t (*send_data)(void *this_arg, LDKu8slice data, bool resume_read);
2745 * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
2746 * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
2747 * this descriptor. No socket_disconnected call should be generated as a result of this call,
2748 * though races may occur whereby disconnect_socket is called after a call to
2749 * socket_disconnected but prior to socket_disconnected returning.
2751 void (*disconnect_socket)(void *this_arg);
2752 bool (*eq)(const void *this_arg, const void *other_arg);
2753 uint64_t (*hash)(const void *this_arg);
2754 void *(*clone)(const void *this_arg);
2755 void (*free)(void *this_arg);
2756 } LDKSocketDescriptor;
2761 * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
2762 * events into messages which it passes on to its MessageHandlers.
2764 * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
2765 * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
2766 * essentially you should default to using a SimpleRefPeerManager, and use a
2767 * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
2768 * you're using lightning-net-tokio.
2770 typedef struct MUST_USE_STRUCT LDKPeerManager {
2772 * Nearly everyhwere, inner must be non-null, however in places where
2773 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2775 LDKnativePeerManager *inner;
2779 typedef struct LDKCVecTempl_PublicKey {
2782 } LDKCVecTempl_PublicKey;
2784 typedef LDKCVecTempl_PublicKey LDKCVec_PublicKeyZ;
2786 typedef union LDKCResultPtr_CVecTempl_u8_____PeerHandleError {
2787 LDKCVecTempl_u8 *result;
2788 LDKPeerHandleError *err;
2789 } LDKCResultPtr_CVecTempl_u8_____PeerHandleError;
2791 typedef struct LDKCResultTempl_CVecTempl_u8_____PeerHandleError {
2792 LDKCResultPtr_CVecTempl_u8_____PeerHandleError contents;
2794 } LDKCResultTempl_CVecTempl_u8_____PeerHandleError;
2796 typedef LDKCResultTempl_CVecTempl_u8_____PeerHandleError LDKCResult_CVec_u8ZPeerHandleErrorZ;
2798 typedef union LDKCResultPtr_bool__PeerHandleError {
2800 LDKPeerHandleError *err;
2801 } LDKCResultPtr_bool__PeerHandleError;
2803 typedef struct LDKCResultTempl_bool__PeerHandleError {
2804 LDKCResultPtr_bool__PeerHandleError contents;
2806 } LDKCResultTempl_bool__PeerHandleError;
2808 typedef LDKCResultTempl_bool__PeerHandleError LDKCResult_boolPeerHandleErrorZ;
2810 typedef union LDKCResultPtr_SecretKey__Secp256k1Error {
2811 LDKSecretKey *result;
2812 LDKSecp256k1Error *err;
2813 } LDKCResultPtr_SecretKey__Secp256k1Error;
2815 typedef struct LDKCResultTempl_SecretKey__Secp256k1Error {
2816 LDKCResultPtr_SecretKey__Secp256k1Error contents;
2818 } LDKCResultTempl_SecretKey__Secp256k1Error;
2820 typedef LDKCResultTempl_SecretKey__Secp256k1Error LDKCResult_SecretKeySecpErrorZ;
2822 typedef union LDKCResultPtr_PublicKey__Secp256k1Error {
2823 LDKPublicKey *result;
2824 LDKSecp256k1Error *err;
2825 } LDKCResultPtr_PublicKey__Secp256k1Error;
2827 typedef struct LDKCResultTempl_PublicKey__Secp256k1Error {
2828 LDKCResultPtr_PublicKey__Secp256k1Error contents;
2830 } LDKCResultTempl_PublicKey__Secp256k1Error;
2832 typedef LDKCResultTempl_PublicKey__Secp256k1Error LDKCResult_PublicKeySecpErrorZ;
2837 * The set of public keys which are used in the creation of one commitment transaction.
2838 * These are derived from the channel base keys and per-commitment data.
2840 * A broadcaster key is provided from potential broadcaster of the computed transaction.
2841 * A countersignatory key is coming from a protocol participant unable to broadcast the
2844 * These keys are assumed to be good, either because the code derived them from
2845 * channel basepoints via the new function, or they were obtained via
2846 * PreCalculatedTxCreationKeys.trust_key_derivation because we trusted the source of the
2847 * pre-calculated keys.
2849 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
2851 * Nearly everyhwere, inner must be non-null, however in places where
2852 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2854 LDKnativeTxCreationKeys *inner;
2856 } LDKTxCreationKeys;
2858 typedef union LDKCResultPtr_TxCreationKeys__Secp256k1Error {
2859 LDKTxCreationKeys *result;
2860 LDKSecp256k1Error *err;
2861 } LDKCResultPtr_TxCreationKeys__Secp256k1Error;
2863 typedef struct LDKCResultTempl_TxCreationKeys__Secp256k1Error {
2864 LDKCResultPtr_TxCreationKeys__Secp256k1Error contents;
2866 } LDKCResultTempl_TxCreationKeys__Secp256k1Error;
2868 typedef LDKCResultTempl_TxCreationKeys__Secp256k1Error LDKCResult_TxCreationKeysSecpErrorZ;
2870 typedef struct LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature {
2871 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *data;
2873 } LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature;
2875 typedef LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ;
2880 * Features used within a `node_announcement` message.
2882 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
2884 * Nearly everyhwere, inner must be non-null, however in places where
2885 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2887 LDKnativeNodeFeatures *inner;
2894 * Features used within a `channel_announcement` message.
2896 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
2898 * Nearly everyhwere, inner must be non-null, however in places where
2899 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2901 LDKnativeChannelFeatures *inner;
2903 } LDKChannelFeatures;
2910 typedef struct MUST_USE_STRUCT LDKRouteHop {
2912 * Nearly everyhwere, inner must be non-null, however in places where
2913 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2915 LDKnativeRouteHop *inner;
2919 typedef struct LDKCVecTempl_RouteHop {
2922 } LDKCVecTempl_RouteHop;
2924 typedef struct LDKCVecTempl_CVecTempl_RouteHop {
2925 LDKCVecTempl_RouteHop *data;
2927 } LDKCVecTempl_CVecTempl_RouteHop;
2929 typedef LDKCVecTempl_CVecTempl_RouteHop LDKCVec_CVec_RouteHopZZ;
2934 * A channel descriptor which provides a last-hop route to get_route
2936 typedef struct MUST_USE_STRUCT LDKRouteHint {
2938 * Nearly everyhwere, inner must be non-null, however in places where
2939 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2941 LDKnativeRouteHint *inner;
2948 * Fees for routing via a given channel or a node
2950 typedef struct MUST_USE_STRUCT LDKRoutingFees {
2952 * Nearly everyhwere, inner must be non-null, however in places where
2953 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2955 LDKnativeRoutingFees *inner;
2959 typedef union LDKCResultPtr_Route__LightningError {
2961 LDKLightningError *err;
2962 } LDKCResultPtr_Route__LightningError;
2964 typedef struct LDKCResultTempl_Route__LightningError {
2965 LDKCResultPtr_Route__LightningError contents;
2967 } LDKCResultTempl_Route__LightningError;
2969 typedef LDKCResultTempl_Route__LightningError LDKCResult_RouteLightningErrorZ;
2974 * Represents the network as nodes and channels between them
2976 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
2978 * Nearly everyhwere, inner must be non-null, however in places where
2979 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2981 LDKnativeNetworkGraph *inner;
2985 typedef struct LDKCVecTempl_RouteHint {
2988 } LDKCVecTempl_RouteHint;
2990 typedef LDKCVecTempl_RouteHint LDKCVec_RouteHintZ;
2995 * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
2996 * This exists only to make accessing a RwLock<NetworkGraph> possible from
2997 * the C bindings, as it can be done directly in Rust code.
2999 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
3001 * Nearly everyhwere, inner must be non-null, however in places where
3002 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3004 LDKnativeLockedNetworkGraph *inner;
3006 } LDKLockedNetworkGraph;
3011 * Receives and validates network updates from peers,
3012 * stores authentic and relevant data as a network graph.
3013 * This network graph is then used for routing payments.
3014 * Provides interface to help with initial routing sync by
3015 * serving historical announcements.
3017 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
3019 * Nearly everyhwere, inner must be non-null, however in places where
3020 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3022 LDKnativeNetGraphMsgHandler *inner;
3024 } LDKNetGraphMsgHandler;
3029 * Details about one direction of a channel. Received
3030 * within a channel update.
3032 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
3034 * Nearly everyhwere, inner must be non-null, however in places where
3035 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3037 LDKnativeDirectionalChannelInfo *inner;
3039 } LDKDirectionalChannelInfo;
3044 * Details about a channel (both directions).
3045 * Received within a channel announcement.
3047 typedef struct MUST_USE_STRUCT LDKChannelInfo {
3049 * Nearly everyhwere, inner must be non-null, however in places where
3050 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3052 LDKnativeChannelInfo *inner;
3059 * Information received in the latest node_announcement from this node.
3061 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
3063 * Nearly everyhwere, inner must be non-null, however in places where
3064 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3066 LDKnativeNodeAnnouncementInfo *inner;
3068 } LDKNodeAnnouncementInfo;
3073 * Details about a node in the network, known from the network announcement.
3075 typedef struct MUST_USE_STRUCT LDKNodeInfo {
3077 * Nearly everyhwere, inner must be non-null, however in places where
3078 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3080 LDKnativeNodeInfo *inner;
3084 typedef LDKCVecTempl_RouteHop LDKCVec_RouteHopZ;
3086 extern const void (*C2Tuple_HTLCOutputInCommitmentSignatureZ_free)(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ);
3088 extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ);
3090 extern const void (*C2Tuple_Scriptu64Z_free)(LDKC2Tuple_Scriptu64Z);
3092 extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ);
3094 extern const void (*C2Tuple_Txidu32Z_free)(LDKC2Tuple_Txidu32Z);
3096 extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z);
3098 extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ);
3100 extern const LDKCResult_C2Tuple_Scriptu64ZChainErrorZ (*CResult_C2Tuple_Scriptu64ZChainErrorZ_err)(LDKChainError);
3102 extern const void (*CResult_C2Tuple_Scriptu64ZChainErrorZ_free)(LDKCResult_C2Tuple_Scriptu64ZChainErrorZ);
3104 extern const LDKCResult_C2Tuple_Scriptu64ZChainErrorZ (*CResult_C2Tuple_Scriptu64ZChainErrorZ_ok)(LDKC2Tuple_Scriptu64Z);
3106 extern const void (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free)(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ);
3108 extern const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok)(LDKC2Tuple_SignatureCVec_SignatureZZ);
3110 extern const void (*CResult_CVec_SignatureZNoneZ_free)(LDKCResult_CVec_SignatureZNoneZ);
3112 extern const LDKCResult_CVec_SignatureZNoneZ (*CResult_CVec_SignatureZNoneZ_ok)(LDKCVec_SignatureZ);
3114 extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_err)(LDKPeerHandleError);
3116 extern const void (*CResult_CVec_u8ZPeerHandleErrorZ_free)(LDKCResult_CVec_u8ZPeerHandleErrorZ);
3118 extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_ok)(LDKCVec_u8Z);
3120 extern const LDKCResult_NoneAPIErrorZ (*CResult_NoneAPIErrorZ_err)(LDKAPIError);
3122 extern const void (*CResult_NoneAPIErrorZ_free)(LDKCResult_NoneAPIErrorZ);
3124 extern const LDKCResult_NoneChannelMonitorUpdateErrZ (*CResult_NoneChannelMonitorUpdateErrZ_err)(LDKChannelMonitorUpdateErr);
3126 extern const void (*CResult_NoneChannelMonitorUpdateErrZ_free)(LDKCResult_NoneChannelMonitorUpdateErrZ);
3128 extern const LDKCResult_NoneMonitorUpdateErrorZ (*CResult_NoneMonitorUpdateErrorZ_err)(LDKMonitorUpdateError);
3130 extern const void (*CResult_NoneMonitorUpdateErrorZ_free)(LDKCResult_NoneMonitorUpdateErrorZ);
3132 extern const LDKCResult_NonePaymentSendFailureZ (*CResult_NonePaymentSendFailureZ_err)(LDKPaymentSendFailure);
3134 extern const void (*CResult_NonePaymentSendFailureZ_free)(LDKCResult_NonePaymentSendFailureZ);
3136 extern const LDKCResult_NonePeerHandleErrorZ (*CResult_NonePeerHandleErrorZ_err)(LDKPeerHandleError);
3138 extern const void (*CResult_NonePeerHandleErrorZ_free)(LDKCResult_NonePeerHandleErrorZ);
3140 extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_err)(LDKSecp256k1Error);
3142 extern const void (*CResult_PublicKeySecpErrorZ_free)(LDKCResult_PublicKeySecpErrorZ);
3144 extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_ok)(LDKPublicKey);
3146 extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_err)(LDKLightningError);
3148 extern const void (*CResult_RouteLightningErrorZ_free)(LDKCResult_RouteLightningErrorZ);
3150 extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_ok)(LDKRoute);
3152 extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_err)(LDKSecp256k1Error);
3154 extern const void (*CResult_SecretKeySecpErrorZ_free)(LDKCResult_SecretKeySecpErrorZ);
3156 extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_ok)(LDKSecretKey);
3158 extern const void (*CResult_SignatureNoneZ_free)(LDKCResult_SignatureNoneZ);
3160 extern const LDKCResult_SignatureNoneZ (*CResult_SignatureNoneZ_ok)(LDKSignature);
3162 extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_err)(LDKSecp256k1Error);
3164 extern const void (*CResult_TxCreationKeysSecpErrorZ_free)(LDKCResult_TxCreationKeysSecpErrorZ);
3166 extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_ok)(LDKTxCreationKeys);
3168 extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_err)(LDKLightningError);
3170 extern const void (*CResult_boolLightningErrorZ_free)(LDKCResult_boolLightningErrorZ);
3172 extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_ok)(bool);
3174 extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_err)(LDKPeerHandleError);
3176 extern const void (*CResult_boolPeerHandleErrorZ_free)(LDKCResult_boolPeerHandleErrorZ);
3178 extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_ok)(bool);
3180 extern const void (*CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free)(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ);
3182 extern const void (*CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free)(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ);
3184 extern const void (*CVec_CVec_RouteHopZZ_free)(LDKCVec_CVec_RouteHopZZ);
3186 extern const void (*CVec_ChannelDetailsZ_free)(LDKCVec_ChannelDetailsZ);
3188 extern const void (*CVec_ChannelMonitorZ_free)(LDKCVec_ChannelMonitorZ);
3190 extern const void (*CVec_EventZ_free)(LDKCVec_EventZ);
3192 extern const void (*CVec_HTLCOutputInCommitmentZ_free)(LDKCVec_HTLCOutputInCommitmentZ);
3194 extern const void (*CVec_MessageSendEventZ_free)(LDKCVec_MessageSendEventZ);
3196 extern const void (*CVec_MonitorEventZ_free)(LDKCVec_MonitorEventZ);
3198 extern const void (*CVec_NetAddressZ_free)(LDKCVec_NetAddressZ);
3200 extern const void (*CVec_NodeAnnouncementZ_free)(LDKCVec_NodeAnnouncementZ);
3202 extern const void (*CVec_PublicKeyZ_free)(LDKCVec_PublicKeyZ);
3204 extern const void (*CVec_RouteHintZ_free)(LDKCVec_RouteHintZ);
3206 extern const void (*CVec_RouteHopZ_free)(LDKCVec_RouteHopZ);
3208 extern const void (*CVec_SignatureZ_free)(LDKCVec_SignatureZ);
3210 extern const void (*CVec_SpendableOutputDescriptorZ_free)(LDKCVec_SpendableOutputDescriptorZ);
3212 extern const void (*CVec_TransactionZ_free)(LDKCVec_TransactionZ);
3214 extern const void (*CVec_UpdateAddHTLCZ_free)(LDKCVec_UpdateAddHTLCZ);
3216 extern const void (*CVec_UpdateFailHTLCZ_free)(LDKCVec_UpdateFailHTLCZ);
3218 extern const void (*CVec_UpdateFailMalformedHTLCZ_free)(LDKCVec_UpdateFailMalformedHTLCZ);
3220 extern const void (*CVec_UpdateFulfillHTLCZ_free)(LDKCVec_UpdateFulfillHTLCZ);
3222 extern const void (*CVec_u64Z_free)(LDKCVec_u64Z);
3224 extern const void (*CVec_u8Z_free)(LDKCVec_u8Z);
3226 extern const void (*CVec_usizeZ_free)(LDKCVec_usizeZ);
3228 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
3230 void TxOut_free(LDKTxOut _res);
3232 LDKC2Tuple_Txidu32Z C2Tuple_Txidu32Z_new(LDKThirtyTwoBytes a, uint32_t b);
3234 LDKC2Tuple_Scriptu64Z C2Tuple_Scriptu64Z_new(LDKCVec_u8Z a, uint64_t b);
3236 LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
3238 LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(LDKSignature a, LDKCVec_SignatureZ b);
3240 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
3242 LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
3244 LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
3246 LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
3248 LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
3250 LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
3252 LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
3254 LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(LDKOutPoint a, LDKCVec_u8Z b);
3256 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(LDKChannelAnnouncement a, LDKChannelUpdate b, LDKChannelUpdate c);
3258 LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
3260 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ C2Tuple_HTLCOutputInCommitmentSignatureZ_new(LDKHTLCOutputInCommitment a, LDKSignature b);
3262 void Event_free(LDKEvent this_ptr);
3264 void MessageSendEvent_free(LDKMessageSendEvent this_ptr);
3267 * Calls the free function if one is set
3269 void MessageSendEventsProvider_free(LDKMessageSendEventsProvider this_ptr);
3272 * Calls the free function if one is set
3274 void EventsProvider_free(LDKEventsProvider this_ptr);
3276 void APIError_free(LDKAPIError this_ptr);
3279 * Returns the most verbose logging level.
3281 MUST_USE_RES LDKLevel Level_max(void);
3284 * Calls the free function if one is set
3286 void Logger_free(LDKLogger this_ptr);
3288 void ChannelHandshakeConfig_free(LDKChannelHandshakeConfig this_ptr);
3291 * Confirmations we will wait for before considering the channel locked in.
3292 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3293 * equivalent limit applied to outbound channels).
3297 uint32_t ChannelHandshakeConfig_get_minimum_depth(const LDKChannelHandshakeConfig *this_ptr);
3300 * Confirmations we will wait for before considering the channel locked in.
3301 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3302 * equivalent limit applied to outbound channels).
3306 void ChannelHandshakeConfig_set_minimum_depth(LDKChannelHandshakeConfig *this_ptr, uint32_t val);
3309 * Set to the amount of time we require our counterparty to wait to claim their money.
3311 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3312 * be online to check for peer having broadcast a revoked transaction to steal our funds
3313 * at least once every our_to_self_delay blocks.
3315 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3316 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3319 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3320 * opening so you can tweak config to ask for more security, not less.
3322 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const LDKChannelHandshakeConfig *this_ptr);
3325 * Set to the amount of time we require our counterparty to wait to claim their money.
3327 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3328 * be online to check for peer having broadcast a revoked transaction to steal our funds
3329 * at least once every our_to_self_delay blocks.
3331 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3332 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3335 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3336 * opening so you can tweak config to ask for more security, not less.
3338 void ChannelHandshakeConfig_set_our_to_self_delay(LDKChannelHandshakeConfig *this_ptr, uint16_t val);
3341 * Set to the smallest value HTLC we will accept to process.
3343 * This value is sent to our counterparty on channel-open and we close the channel any time
3344 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3346 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3349 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const LDKChannelHandshakeConfig *this_ptr);
3352 * Set to the smallest value HTLC we will accept to process.
3354 * This value is sent to our counterparty on channel-open and we close the channel any time
3355 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3357 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3360 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(LDKChannelHandshakeConfig *this_ptr, uint64_t val);
3362 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);
3364 MUST_USE_RES LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
3366 void ChannelHandshakeLimits_free(LDKChannelHandshakeLimits this_ptr);
3369 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3370 * only applies to inbound channels.
3374 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3377 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3378 * only applies to inbound channels.
3382 void ChannelHandshakeLimits_set_min_funding_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3385 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
3386 * you to limit the maximum minimum-size they can require.
3388 * Default value: u64::max_value.
3390 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const LDKChannelHandshakeLimits *this_ptr);
3393 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
3394 * you to limit the maximum minimum-size they can require.
3396 * Default value: u64::max_value.
3398 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3401 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
3402 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
3406 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const LDKChannelHandshakeLimits *this_ptr);
3409 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
3410 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
3414 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3417 * The remote node will require we keep a certain amount in direct payment to ourselves at all
3418 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
3419 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
3421 * Default value: u64::max_value.
3423 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3426 * The remote node will require we keep a certain amount in direct payment to ourselves at all
3427 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
3428 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
3430 * Default value: u64::max_value.
3432 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3435 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
3436 * time. This allows you to set a minimum such value.
3440 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const LDKChannelHandshakeLimits *this_ptr);
3443 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
3444 * time. This allows you to set a minimum such value.
3448 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(LDKChannelHandshakeLimits *this_ptr, uint16_t val);
3451 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
3452 * required to always be higher than this value so this only applies to HTLC outputs (and
3453 * potentially to-self outputs before any payments have been made).
3454 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3455 * This setting allows you to set a minimum dust limit for their commitment transactions,
3456 * reflecting the reality that tiny outputs are not considered standard transactions and will
3457 * not propagate through the Bitcoin network.
3459 * Default value: 546, the current dust limit on the Bitcoin network.
3461 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3464 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
3465 * required to always be higher than this value so this only applies to HTLC outputs (and
3466 * potentially to-self outputs before any payments have been made).
3467 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3468 * This setting allows you to set a minimum dust limit for their commitment transactions,
3469 * reflecting the reality that tiny outputs are not considered standard transactions and will
3470 * not propagate through the Bitcoin network.
3472 * Default value: 546, the current dust limit on the Bitcoin network.
3474 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3477 * Maximum allowed threshold above which outputs will not be generated in their commitment
3479 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3481 * Default value: u64::max_value.
3483 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3486 * Maximum allowed threshold above which outputs will not be generated in their commitment
3488 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3490 * Default value: u64::max_value.
3492 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3495 * Before a channel is usable the funding transaction will need to be confirmed by at least a
3496 * certain number of blocks, specified by the node which is not the funder (as the funder can
3497 * assume they aren't going to double-spend themselves).
3498 * This config allows you to set a limit on the maximum amount of time to wait.
3500 * Default value: 144, or roughly one day and only applies to outbound channels.
3502 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const LDKChannelHandshakeLimits *this_ptr);
3505 * Before a channel is usable the funding transaction will need to be confirmed by at least a
3506 * certain number of blocks, specified by the node which is not the funder (as the funder can
3507 * assume they aren't going to double-spend themselves).
3508 * This config allows you to set a limit on the maximum amount of time to wait.
3510 * Default value: 144, or roughly one day and only applies to outbound channels.
3512 void ChannelHandshakeLimits_set_max_minimum_depth(LDKChannelHandshakeLimits *this_ptr, uint32_t val);
3515 * Set to force the incoming channel to match our announced channel preference in
3518 * Default value: true, to make the default that no announced channels are possible (which is
3519 * appropriate for any nodes which are not online very reliably).
3521 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const LDKChannelHandshakeLimits *this_ptr);
3524 * Set to force the incoming channel to match our announced channel preference in
3527 * Default value: true, to make the default that no announced channels are possible (which is
3528 * appropriate for any nodes which are not online very reliably).
3530 void ChannelHandshakeLimits_set_force_announced_channel_preference(LDKChannelHandshakeLimits *this_ptr, bool val);
3533 * Set to the amount of time we're willing to wait to claim money back to us.
3535 * Not checking this value would be a security issue, as our peer would be able to set it to
3536 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
3538 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
3539 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
3541 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const LDKChannelHandshakeLimits *this_ptr);
3544 * Set to the amount of time we're willing to wait to claim money back to us.
3546 * Not checking this value would be a security issue, as our peer would be able to set it to
3547 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
3549 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
3550 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
3552 void ChannelHandshakeLimits_set_their_to_self_delay(LDKChannelHandshakeLimits *this_ptr, uint16_t val);
3554 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);
3556 MUST_USE_RES LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
3558 void ChannelConfig_free(LDKChannelConfig this_ptr);
3561 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
3562 * This may be allowed to change at runtime in a later update, however doing so must result in
3563 * update messages sent to notify all nodes of our updated relay fee.
3567 uint32_t ChannelConfig_get_fee_proportional_millionths(const LDKChannelConfig *this_ptr);
3570 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
3571 * This may be allowed to change at runtime in a later update, however doing so must result in
3572 * update messages sent to notify all nodes of our updated relay fee.
3576 void ChannelConfig_set_fee_proportional_millionths(LDKChannelConfig *this_ptr, uint32_t val);
3579 * Set to announce the channel publicly and notify all nodes that they can route via this
3582 * This should only be set to true for nodes which expect to be online reliably.
3584 * As the node which funds a channel picks this value this will only apply for new outbound
3585 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
3587 * This cannot be changed after the initial channel handshake.
3589 * Default value: false.
3591 bool ChannelConfig_get_announced_channel(const LDKChannelConfig *this_ptr);
3594 * Set to announce the channel publicly and notify all nodes that they can route via this
3597 * This should only be set to true for nodes which expect to be online reliably.
3599 * As the node which funds a channel picks this value this will only apply for new outbound
3600 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
3602 * This cannot be changed after the initial channel handshake.
3604 * Default value: false.
3606 void ChannelConfig_set_announced_channel(LDKChannelConfig *this_ptr, bool val);
3609 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
3610 * supports it, they will then enforce the mutual-close output to us matches what we provided
3611 * at intialization, preventing us from closing to an alternate pubkey.
3613 * This is set to true by default to provide a slight increase in security, though ultimately
3614 * any attacker who is able to take control of a channel can just as easily send the funds via
3615 * lightning payments, so we never require that our counterparties support this option.
3617 * This cannot be changed after a channel has been initialized.
3619 * Default value: true.
3621 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const LDKChannelConfig *this_ptr);
3624 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
3625 * supports it, they will then enforce the mutual-close output to us matches what we provided
3626 * at intialization, preventing us from closing to an alternate pubkey.
3628 * This is set to true by default to provide a slight increase in security, though ultimately
3629 * any attacker who is able to take control of a channel can just as easily send the funds via
3630 * lightning payments, so we never require that our counterparties support this option.
3632 * This cannot be changed after a channel has been initialized.
3634 * Default value: true.
3636 void ChannelConfig_set_commit_upfront_shutdown_pubkey(LDKChannelConfig *this_ptr, bool val);
3638 MUST_USE_RES LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
3640 MUST_USE_RES LDKChannelConfig ChannelConfig_default(void);
3642 LDKCVec_u8Z ChannelConfig_write(const LDKChannelConfig *obj);
3644 LDKChannelConfig ChannelConfig_read(LDKu8slice ser);
3646 void UserConfig_free(LDKUserConfig this_ptr);
3649 * Channel config that we propose to our counterparty.
3651 LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const LDKUserConfig *this_ptr);
3654 * Channel config that we propose to our counterparty.
3656 void UserConfig_set_own_channel_config(LDKUserConfig *this_ptr, LDKChannelHandshakeConfig val);
3659 * Limits applied to our counterparty's proposed channel config settings.
3661 LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const LDKUserConfig *this_ptr);
3664 * Limits applied to our counterparty's proposed channel config settings.
3666 void UserConfig_set_peer_channel_config_limits(LDKUserConfig *this_ptr, LDKChannelHandshakeLimits val);
3669 * Channel config which affects behavior during channel lifetime.
3671 LDKChannelConfig UserConfig_get_channel_options(const LDKUserConfig *this_ptr);
3674 * Channel config which affects behavior during channel lifetime.
3676 void UserConfig_set_channel_options(LDKUserConfig *this_ptr, LDKChannelConfig val);
3678 MUST_USE_RES LDKUserConfig UserConfig_new(LDKChannelHandshakeConfig own_channel_config_arg, LDKChannelHandshakeLimits peer_channel_config_limits_arg, LDKChannelConfig channel_options_arg);
3680 MUST_USE_RES LDKUserConfig UserConfig_default(void);
3683 * Calls the free function if one is set
3685 void ChainWatchInterface_free(LDKChainWatchInterface this_ptr);
3688 * Calls the free function if one is set
3690 void BroadcasterInterface_free(LDKBroadcasterInterface this_ptr);
3693 * Calls the free function if one is set
3695 void ChainListener_free(LDKChainListener this_ptr);
3698 * Calls the free function if one is set
3700 void FeeEstimator_free(LDKFeeEstimator this_ptr);
3702 void ChainWatchedUtil_free(LDKChainWatchedUtil this_ptr);
3705 * Constructs an empty (watches nothing) ChainWatchedUtil
3707 MUST_USE_RES LDKChainWatchedUtil ChainWatchedUtil_new(void);
3710 * Registers a tx for monitoring, returning true if it was a new tx and false if we'd already
3711 * been watching for it.
3713 MUST_USE_RES bool ChainWatchedUtil_register_tx(LDKChainWatchedUtil *this_arg, const uint8_t (*txid)[32], LDKu8slice script_pub_key);
3716 * Registers an outpoint for monitoring, returning true if it was a new outpoint and false if
3717 * we'd already been watching for it
3719 MUST_USE_RES bool ChainWatchedUtil_register_outpoint(LDKChainWatchedUtil *this_arg, LDKC2Tuple_Txidu32Z outpoint, LDKu8slice _script_pub_key);
3722 * Sets us to match all transactions, returning true if this is a new setting and false if
3723 * we'd already been set to match everything.
3725 MUST_USE_RES bool ChainWatchedUtil_watch_all(LDKChainWatchedUtil *this_arg);
3728 * Checks if a given transaction matches the current filter.
3730 MUST_USE_RES bool ChainWatchedUtil_does_match_tx(const LDKChainWatchedUtil *this_arg, LDKTransaction tx);
3732 void BlockNotifier_free(LDKBlockNotifier this_ptr);
3735 * Constructs a new BlockNotifier without any listeners.
3737 MUST_USE_RES LDKBlockNotifier BlockNotifier_new(LDKChainWatchInterface chain_monitor);
3740 * Register the given listener to receive events.
3742 void BlockNotifier_register_listener(const LDKBlockNotifier *this_arg, LDKChainListener listener);
3745 * Notify listeners that a block was connected given a full, unfiltered block.
3747 * Handles re-scanning the block and calling block_connected again if listeners register new
3748 * watch data during the callbacks for you (see ChainListener::block_connected for more info).
3750 void BlockNotifier_block_connected(const LDKBlockNotifier *this_arg, LDKu8slice block, uint32_t height);
3753 * Notify listeners that a block was connected, given pre-filtered list of transactions in the
3754 * block which matched the filter (probably using does_match_tx).
3756 * Returns true if notified listeners registered additional watch data (implying that the
3757 * block must be re-scanned and this function called again prior to further block_connected
3758 * calls, see ChainListener::block_connected for more info).
3760 MUST_USE_RES bool BlockNotifier_block_connected_checked(const LDKBlockNotifier *this_arg, const uint8_t (*header)[80], uint32_t height, LDKCVec_TransactionZ txn_matched, LDKusizeslice indexes_of_txn_matched);
3763 * Notify listeners that a block was disconnected.
3765 void BlockNotifier_block_disconnected(const LDKBlockNotifier *this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
3767 void ChainWatchInterfaceUtil_free(LDKChainWatchInterfaceUtil this_ptr);
3769 LDKChainWatchInterface ChainWatchInterfaceUtil_as_ChainWatchInterface(const LDKChainWatchInterfaceUtil *this_arg);
3772 * Creates a new ChainWatchInterfaceUtil for the given network
3774 MUST_USE_RES LDKChainWatchInterfaceUtil ChainWatchInterfaceUtil_new(LDKNetwork network);
3777 * Checks if a given transaction matches the current filter.
3779 MUST_USE_RES bool ChainWatchInterfaceUtil_does_match_tx(const LDKChainWatchInterfaceUtil *this_arg, LDKTransaction tx);
3781 void OutPoint_free(LDKOutPoint this_ptr);
3784 * The referenced transaction's txid.
3786 const uint8_t (*OutPoint_get_txid(const LDKOutPoint *this_ptr))[32];
3789 * The referenced transaction's txid.
3791 void OutPoint_set_txid(LDKOutPoint *this_ptr, LDKThirtyTwoBytes val);
3794 * The index of the referenced output in its transaction's vout.
3796 uint16_t OutPoint_get_index(const LDKOutPoint *this_ptr);
3799 * The index of the referenced output in its transaction's vout.
3801 void OutPoint_set_index(LDKOutPoint *this_ptr, uint16_t val);
3803 MUST_USE_RES LDKOutPoint OutPoint_new(LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
3806 * Convert an `OutPoint` to a lightning channel id.
3808 MUST_USE_RES LDKThirtyTwoBytes OutPoint_to_channel_id(const LDKOutPoint *this_arg);
3810 LDKCVec_u8Z OutPoint_write(const LDKOutPoint *obj);
3812 LDKOutPoint OutPoint_read(LDKu8slice ser);
3814 void SpendableOutputDescriptor_free(LDKSpendableOutputDescriptor this_ptr);
3817 * Calls the free function if one is set
3819 void ChannelKeys_free(LDKChannelKeys this_ptr);
3822 * Calls the free function if one is set
3824 void KeysInterface_free(LDKKeysInterface this_ptr);
3826 void InMemoryChannelKeys_free(LDKInMemoryChannelKeys this_ptr);
3829 * Private key of anchor tx
3831 const uint8_t (*InMemoryChannelKeys_get_funding_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3834 * Private key of anchor tx
3836 void InMemoryChannelKeys_set_funding_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3839 * Holder secret key for blinded revocation pubkey
3841 const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3844 * Holder secret key for blinded revocation pubkey
3846 void InMemoryChannelKeys_set_revocation_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3849 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
3851 const uint8_t (*InMemoryChannelKeys_get_payment_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3854 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
3856 void InMemoryChannelKeys_set_payment_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3859 * Holder secret key used in HTLC tx
3861 const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3864 * Holder secret key used in HTLC tx
3866 void InMemoryChannelKeys_set_delayed_payment_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3869 * Holder htlc secret key used in commitment tx htlc outputs
3871 const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3874 * Holder htlc secret key used in commitment tx htlc outputs
3876 void InMemoryChannelKeys_set_htlc_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3881 const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const LDKInMemoryChannelKeys *this_ptr))[32];
3886 void InMemoryChannelKeys_set_commitment_seed(LDKInMemoryChannelKeys *this_ptr, LDKThirtyTwoBytes val);
3889 * Create a new InMemoryChannelKeys
3891 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);
3894 * Counterparty pubkeys.
3895 * Will panic if on_accept wasn't called.
3897 MUST_USE_RES LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const LDKInMemoryChannelKeys *this_arg);
3900 * The contest_delay value specified by our counterparty and applied on holder-broadcastable
3901 * transactions, ie the amount of time that we have to wait to recover our funds if we
3902 * broadcast a transaction. You'll likely want to pass this to the
3903 * ln::chan_utils::build*_transaction functions when signing holder's transactions.
3904 * Will panic if on_accept wasn't called.
3906 MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const LDKInMemoryChannelKeys *this_arg);
3909 * The contest_delay value specified by us and applied on transactions broadcastable
3910 * by our counterparty, ie the amount of time that they have to wait to recover their funds
3911 * if they broadcast a transaction.
3912 * Will panic if on_accept wasn't called.
3914 MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const LDKInMemoryChannelKeys *this_arg);
3916 LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const LDKInMemoryChannelKeys *this_arg);
3918 LDKCVec_u8Z InMemoryChannelKeys_write(const LDKInMemoryChannelKeys *obj);
3920 LDKInMemoryChannelKeys InMemoryChannelKeys_read(LDKu8slice ser);
3922 void KeysManager_free(LDKKeysManager this_ptr);
3925 * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
3926 * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
3927 * starting_time isn't strictly required to actually be a time, but it must absolutely,
3928 * without a doubt, be unique to this instance. ie if you start multiple times with the same
3929 * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
3930 * simply use the current time (with very high precision).
3932 * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
3933 * obviously, starting_time should be unique every time you reload the library - it is only
3934 * used to generate new ephemeral key data (which will be stored by the individual channel if
3937 * Note that the seed is required to recover certain on-chain funds independent of
3938 * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
3939 * channel, and some on-chain during-closing funds.
3941 * Note that until the 0.1 release there is no guarantee of backward compatibility between
3942 * versions. Once the library is more fully supported, the docs will be updated to include a
3943 * detailed description of the guarantee.
3945 MUST_USE_RES LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos);
3948 * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation
3950 * Key derivation parameters are accessible through a per-channel secrets
3951 * ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of
3952 * onchain output detection for which a corresponding delayed_payment_key must be derived.
3954 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);
3956 LDKKeysInterface KeysManager_as_KeysInterface(const LDKKeysManager *this_arg);
3958 void ChannelManager_free(LDKChannelManager this_ptr);
3960 void ChannelDetails_free(LDKChannelDetails this_ptr);
3963 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
3964 * thereafter this is the txid of the funding transaction xor the funding transaction output).
3965 * Note that this means this value is *not* persistent - it can change once during the
3966 * lifetime of the channel.
3968 const uint8_t (*ChannelDetails_get_channel_id(const LDKChannelDetails *this_ptr))[32];
3971 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
3972 * thereafter this is the txid of the funding transaction xor the funding transaction output).
3973 * Note that this means this value is *not* persistent - it can change once during the
3974 * lifetime of the channel.
3976 void ChannelDetails_set_channel_id(LDKChannelDetails *this_ptr, LDKThirtyTwoBytes val);
3979 * The node_id of our counterparty
3981 LDKPublicKey ChannelDetails_get_remote_network_id(const LDKChannelDetails *this_ptr);
3984 * The node_id of our counterparty
3986 void ChannelDetails_set_remote_network_id(LDKChannelDetails *this_ptr, LDKPublicKey val);
3989 * The Features the channel counterparty provided upon last connection.
3990 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
3991 * many routing-relevant features are present in the init context.
3993 LDKInitFeatures ChannelDetails_get_counterparty_features(const LDKChannelDetails *this_ptr);
3996 * The Features the channel counterparty provided upon last connection.
3997 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
3998 * many routing-relevant features are present in the init context.
4000 void ChannelDetails_set_counterparty_features(LDKChannelDetails *this_ptr, LDKInitFeatures val);
4003 * The value, in satoshis, of this channel as appears in the funding output
4005 uint64_t ChannelDetails_get_channel_value_satoshis(const LDKChannelDetails *this_ptr);
4008 * The value, in satoshis, of this channel as appears in the funding output
4010 void ChannelDetails_set_channel_value_satoshis(LDKChannelDetails *this_ptr, uint64_t val);
4013 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4015 uint64_t ChannelDetails_get_user_id(const LDKChannelDetails *this_ptr);
4018 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4020 void ChannelDetails_set_user_id(LDKChannelDetails *this_ptr, uint64_t val);
4023 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4024 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4025 * available for inclusion in new outbound HTLCs). This further does not include any pending
4026 * outgoing HTLCs which are awaiting some other resolution to be sent.
4028 uint64_t ChannelDetails_get_outbound_capacity_msat(const LDKChannelDetails *this_ptr);
4031 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4032 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4033 * available for inclusion in new outbound HTLCs). This further does not include any pending
4034 * outgoing HTLCs which are awaiting some other resolution to be sent.
4036 void ChannelDetails_set_outbound_capacity_msat(LDKChannelDetails *this_ptr, uint64_t val);
4039 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4040 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4041 * available for inclusion in new inbound HTLCs).
4042 * Note that there are some corner cases not fully handled here, so the actual available
4043 * inbound capacity may be slightly higher than this.
4045 uint64_t ChannelDetails_get_inbound_capacity_msat(const LDKChannelDetails *this_ptr);
4048 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4049 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4050 * available for inclusion in new inbound HTLCs).
4051 * Note that there are some corner cases not fully handled here, so the actual available
4052 * inbound capacity may be slightly higher than this.
4054 void ChannelDetails_set_inbound_capacity_msat(LDKChannelDetails *this_ptr, uint64_t val);
4057 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4058 * the peer is connected, and (c) no monitor update failure is pending resolution.
4060 bool ChannelDetails_get_is_live(const LDKChannelDetails *this_ptr);
4063 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4064 * the peer is connected, and (c) no monitor update failure is pending resolution.
4066 void ChannelDetails_set_is_live(LDKChannelDetails *this_ptr, bool val);
4068 void PaymentSendFailure_free(LDKPaymentSendFailure this_ptr);
4071 * Constructs a new ChannelManager to hold several channels and route between them.
4073 * This is the main \"logic hub\" for all channel-related actions, and implements
4074 * ChannelMessageHandler.
4076 * Non-proportional fees are fixed according to our risk using the provided fee estimator.
4078 * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
4080 * Users must provide the current blockchain height from which to track onchain channel
4081 * funding outpoints and send payments with reliable timelocks.
4083 * Users need to notify the new ChannelManager when a new block is connected or
4084 * disconnected using its `block_connected` and `block_disconnected` methods.
4085 * However, rather than calling these methods directly, the user should register
4086 * the ChannelManager as a listener to the BlockNotifier and call the BlockNotifier's
4087 * `block_(dis)connected` methods, which will notify all registered listeners in one
4090 MUST_USE_RES LDKChannelManager ChannelManager_new(LDKNetwork network, LDKFeeEstimator fee_est, LDKManyChannelMonitor monitor, LDKBroadcasterInterface tx_broadcaster, LDKLogger logger, LDKKeysInterface keys_manager, LDKUserConfig config, uintptr_t current_blockchain_height);
4093 * Creates a new outbound channel to the given remote node and with the given value.
4095 * user_id will be provided back as user_channel_id in FundingGenerationReady and
4096 * FundingBroadcastSafe events to allow tracking of which events correspond with which
4097 * create_channel call. Note that user_channel_id defaults to 0 for inbound channels, so you
4098 * may wish to avoid using 0 for user_id here.
4100 * If successful, will generate a SendOpenChannel message event, so you should probably poll
4101 * PeerManager::process_events afterwards.
4103 * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
4104 * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
4106 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);
4109 * Gets the list of open channels, in random order. See ChannelDetail field documentation for
4112 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const LDKChannelManager *this_arg);
4115 * Gets the list of usable channels, in random order. Useful as an argument to
4116 * get_route to ensure non-announced channels are used.
4118 * These are guaranteed to have their is_live value set to true, see the documentation for
4119 * ChannelDetails::is_live for more info on exactly what the criteria are.
4121 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const LDKChannelManager *this_arg);
4124 * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
4125 * will be accepted on the given channel, and after additional timeout/the closing of all
4126 * pending HTLCs, the channel will be closed on chain.
4128 * May generate a SendShutdown message event on success, which should be relayed.
4130 MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const LDKChannelManager *this_arg, const uint8_t (*channel_id)[32]);
4133 * Force closes a channel, immediately broadcasting the latest local commitment transaction to
4134 * the chain and rejecting new HTLCs on the given channel.
4136 void ChannelManager_force_close_channel(const LDKChannelManager *this_arg, const uint8_t (*channel_id)[32]);
4139 * Force close all channels, immediately broadcasting the latest local commitment transaction
4140 * for each to the chain and rejecting new HTLCs on each.
4142 void ChannelManager_force_close_all_channels(const LDKChannelManager *this_arg);
4145 * Sends a payment along a given route.
4147 * Value parameters are provided via the last hop in route, see documentation for RouteHop
4148 * fields for more info.
4150 * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
4151 * payment), we don't do anything to stop you! We always try to ensure that if the provided
4152 * next hop knows the preimage to payment_hash they can claim an additional amount as
4153 * specified in the last hop in the route! Thus, you should probably do your own
4154 * payment_preimage tracking (which you should already be doing as they represent \"proof of
4155 * payment\") and prevent double-sends yourself.
4157 * May generate SendHTLCs message(s) event on success, which should be relayed.
4159 * Each path may have a different return value, and PaymentSendValue may return a Vec with
4160 * each entry matching the corresponding-index entry in the route paths, see
4161 * PaymentSendFailure for more info.
4163 * In general, a path may raise:
4164 * * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
4165 * node public key) is specified.
4166 * * APIError::ChannelUnavailable if the next-hop channel is not available for updates
4167 * (including due to previous monitor update failure or new permanent monitor update
4169 * * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
4172 * Note that depending on the type of the PaymentSendFailure the HTLC may have been
4173 * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
4174 * different route unless you intend to pay twice!
4176 * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
4177 * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
4178 * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
4179 * must not contain multiple paths as multi-path payments require a recipient-provided
4181 * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
4182 * bit set (either as required or as available). If multiple paths are present in the Route,
4183 * we assume the invoice had the basic_mpp feature set.
4185 MUST_USE_RES LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const LDKChannelManager *this_arg, const LDKRoute *route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret);
4188 * Call this upon creation of a funding transaction for the given channel.
4190 * Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
4191 * or your counterparty can steal your funds!
4193 * Panics if a funding transaction has already been provided for this channel.
4195 * May panic if the funding_txo is duplicative with some other channel (note that this should
4196 * be trivially prevented by using unique funding transaction keys per-channel).
4198 void ChannelManager_funding_transaction_generated(const LDKChannelManager *this_arg, const uint8_t (*temporary_channel_id)[32], LDKOutPoint funding_txo);
4201 * Generates a signed node_announcement from the given arguments and creates a
4202 * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
4203 * seen a channel_announcement from us (ie unless we have public channels open).
4205 * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
4206 * to humans. They carry no in-protocol meaning.
4208 * addresses represent the set (possibly empty) of socket addresses on which this node accepts
4209 * incoming connections. These will be broadcast to the network, publicly tying these
4210 * addresses together. If you wish to preserve user privacy, addresses should likely contain
4211 * only Tor Onion addresses.
4213 * Panics if addresses is absurdly large (more than 500).
4215 void ChannelManager_broadcast_node_announcement(const LDKChannelManager *this_arg, LDKThreeBytes rgb, LDKThirtyTwoBytes alias, LDKCVec_NetAddressZ addresses);
4218 * Processes HTLCs which are pending waiting on random forward delay.
4220 * Should only really ever be called in response to a PendingHTLCsForwardable event.
4221 * Will likely generate further events.
4223 void ChannelManager_process_pending_htlc_forwards(const LDKChannelManager *this_arg);
4226 * If a peer is disconnected we mark any channels with that peer as 'disabled'.
4227 * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
4228 * to inform the network about the uselessness of these channels.
4230 * This method handles all the details, and must be called roughly once per minute.
4232 void ChannelManager_timer_chan_freshness_every_min(const LDKChannelManager *this_arg);
4235 * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
4236 * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
4237 * along the path (including in our own channel on which we received it).
4238 * Returns false if no payment was found to fail backwards, true if the process of failing the
4239 * HTLC backwards has been started.
4241 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const LDKChannelManager *this_arg, const uint8_t (*payment_hash)[32], LDKThirtyTwoBytes payment_secret);
4244 * Provides a payment preimage in response to a PaymentReceived event, returning true and
4245 * generating message events for the net layer to claim the payment, if possible. Thus, you
4246 * should probably kick the net layer to go send messages if this returns true!
4248 * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
4249 * available within a few percent of the expected amount. This is critical for several
4250 * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
4251 * payment_preimage without having provided the full value and b) it avoids certain
4252 * privacy-breaking recipient-probing attacks which may reveal payment activity to
4253 * motivated attackers.
4255 * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
4256 * set. Thus, for such payments we will claim any payments which do not under-pay.
4258 * May panic if called except in response to a PaymentReceived event.
4260 MUST_USE_RES bool ChannelManager_claim_funds(const LDKChannelManager *this_arg, LDKThirtyTwoBytes payment_preimage, LDKThirtyTwoBytes payment_secret, uint64_t expected_amount);
4263 * Gets the node_id held by this ChannelManager
4265 MUST_USE_RES LDKPublicKey ChannelManager_get_our_node_id(const LDKChannelManager *this_arg);
4268 * Restores a single, given channel to normal operation after a
4269 * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
4272 * All ChannelMonitor updates up to and including highest_applied_update_id must have been
4273 * fully committed in every copy of the given channels' ChannelMonitors.
4275 * Note that there is no effect to calling with a highest_applied_update_id other than the
4276 * current latest ChannelMonitorUpdate and one call to this function after multiple
4277 * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
4278 * exists largely only to prevent races between this and concurrent update_monitor calls.
4280 * Thus, the anticipated use is, at a high level:
4281 * 1) You register a ManyChannelMonitor with this ChannelManager,
4282 * 2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
4283 * said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
4284 * any time it cannot do so instantly,
4285 * 3) update(s) are applied to each remote copy of a ChannelMonitor,
4286 * 4) once all remote copies are updated, you call this function with the update_id that
4287 * completed, and once it is the latest the Channel will be re-enabled.
4289 void ChannelManager_channel_monitor_updated(const LDKChannelManager *this_arg, const LDKOutPoint *funding_txo, uint64_t highest_applied_update_id);
4291 LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const LDKChannelManager *this_arg);
4293 LDKEventsProvider ChannelManager_as_EventsProvider(const LDKChannelManager *this_arg);
4295 LDKChainListener ChannelManager_as_ChainListener(const LDKChannelManager *this_arg);
4297 LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const LDKChannelManager *this_arg);
4299 void ChannelManagerReadArgs_free(LDKChannelManagerReadArgs this_ptr);
4302 * The keys provider which will give us relevant keys. Some keys will be loaded during
4305 const LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const LDKChannelManagerReadArgs *this_ptr);
4308 * The keys provider which will give us relevant keys. Some keys will be loaded during
4311 void ChannelManagerReadArgs_set_keys_manager(LDKChannelManagerReadArgs *this_ptr, LDKKeysInterface val);
4314 * The fee_estimator for use in the ChannelManager in the future.
4316 * No calls to the FeeEstimator will be made during deserialization.
4318 const LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const LDKChannelManagerReadArgs *this_ptr);
4321 * The fee_estimator for use in the ChannelManager in the future.
4323 * No calls to the FeeEstimator will be made during deserialization.
4325 void ChannelManagerReadArgs_set_fee_estimator(LDKChannelManagerReadArgs *this_ptr, LDKFeeEstimator val);
4328 * The ManyChannelMonitor for use in the ChannelManager in the future.
4330 * No calls to the ManyChannelMonitor will be made during deserialization. It is assumed that
4331 * you have deserialized ChannelMonitors separately and will add them to your
4332 * ManyChannelMonitor after deserializing this ChannelManager.
4334 const LDKManyChannelMonitor *ChannelManagerReadArgs_get_monitor(const LDKChannelManagerReadArgs *this_ptr);
4337 * The ManyChannelMonitor for use in the ChannelManager in the future.
4339 * No calls to the ManyChannelMonitor will be made during deserialization. It is assumed that
4340 * you have deserialized ChannelMonitors separately and will add them to your
4341 * ManyChannelMonitor after deserializing this ChannelManager.
4343 void ChannelManagerReadArgs_set_monitor(LDKChannelManagerReadArgs *this_ptr, LDKManyChannelMonitor val);
4346 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
4347 * used to broadcast the latest local commitment transactions of channels which must be
4348 * force-closed during deserialization.
4350 const LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const LDKChannelManagerReadArgs *this_ptr);
4353 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
4354 * used to broadcast the latest local commitment transactions of channels which must be
4355 * force-closed during deserialization.
4357 void ChannelManagerReadArgs_set_tx_broadcaster(LDKChannelManagerReadArgs *this_ptr, LDKBroadcasterInterface val);
4360 * The Logger for use in the ChannelManager and which may be used to log information during
4363 const LDKLogger *ChannelManagerReadArgs_get_logger(const LDKChannelManagerReadArgs *this_ptr);
4366 * The Logger for use in the ChannelManager and which may be used to log information during
4369 void ChannelManagerReadArgs_set_logger(LDKChannelManagerReadArgs *this_ptr, LDKLogger val);
4372 * Default settings used for new channels. Any existing channels will continue to use the
4373 * runtime settings which were stored when the ChannelManager was serialized.
4375 LDKUserConfig ChannelManagerReadArgs_get_default_config(const LDKChannelManagerReadArgs *this_ptr);
4378 * Default settings used for new channels. Any existing channels will continue to use the
4379 * runtime settings which were stored when the ChannelManager was serialized.
4381 void ChannelManagerReadArgs_set_default_config(LDKChannelManagerReadArgs *this_ptr, LDKUserConfig val);
4384 * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
4385 * HashMap for you. This is primarily useful for C bindings where it is not practical to
4386 * populate a HashMap directly from C.
4388 MUST_USE_RES LDKChannelManagerReadArgs ChannelManagerReadArgs_new(LDKKeysInterface keys_manager, LDKFeeEstimator fee_estimator, LDKManyChannelMonitor monitor, LDKBroadcasterInterface tx_broadcaster, LDKLogger logger, LDKUserConfig default_config, LDKCVec_ChannelMonitorZ channel_monitors);
4390 void ChannelMonitorUpdate_free(LDKChannelMonitorUpdate this_ptr);
4393 * The sequence number of this update. Updates *must* be replayed in-order according to this
4394 * sequence number (and updates may panic if they are not). The update_id values are strictly
4395 * increasing and increase by one for each new update.
4397 * This sequence number is also used to track up to which points updates which returned
4398 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4399 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4401 uint64_t ChannelMonitorUpdate_get_update_id(const LDKChannelMonitorUpdate *this_ptr);
4404 * The sequence number of this update. Updates *must* be replayed in-order according to this
4405 * sequence number (and updates may panic if they are not). The update_id values are strictly
4406 * increasing and increase by one for each new update.
4408 * This sequence number is also used to track up to which points updates which returned
4409 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4410 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4412 void ChannelMonitorUpdate_set_update_id(LDKChannelMonitorUpdate *this_ptr, uint64_t val);
4414 LDKCVec_u8Z ChannelMonitorUpdate_write(const LDKChannelMonitorUpdate *obj);
4416 LDKChannelMonitorUpdate ChannelMonitorUpdate_read(LDKu8slice ser);
4418 void MonitorUpdateError_free(LDKMonitorUpdateError this_ptr);
4420 void MonitorEvent_free(LDKMonitorEvent this_ptr);
4422 void HTLCUpdate_free(LDKHTLCUpdate this_ptr);
4424 LDKCVec_u8Z HTLCUpdate_write(const LDKHTLCUpdate *obj);
4426 LDKHTLCUpdate HTLCUpdate_read(LDKu8slice ser);
4428 void ChannelMonitor_free(LDKChannelMonitor this_ptr);
4431 * Calls the free function if one is set
4433 void ManyChannelMonitor_free(LDKManyChannelMonitor this_ptr);
4436 * Updates a ChannelMonitor on the basis of some new information provided by the Channel
4439 * panics if the given update is not the next update by update_id.
4441 MUST_USE_RES LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(LDKChannelMonitor *this_arg, LDKChannelMonitorUpdate updates, const LDKBroadcasterInterface *broadcaster, const LDKLogger *logger);
4444 * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
4447 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const LDKChannelMonitor *this_arg);
4450 * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
4452 MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const LDKChannelMonitor *this_arg);
4455 * Get the list of HTLCs who's status has been updated on chain. This should be called by
4456 * ChannelManager via ManyChannelMonitor::get_and_clear_pending_monitor_events().
4458 MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(LDKChannelMonitor *this_arg);
4461 * Gets the list of pending events which were generated by previous actions, clearing the list
4464 * This is called by ManyChannelMonitor::get_and_clear_pending_events() and is equivalent to
4465 * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
4466 * no internal locking in ChannelMonitors.
4468 MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(LDKChannelMonitor *this_arg);
4471 * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
4472 * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
4473 * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
4474 * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
4475 * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
4476 * broadcast them if counterparty don't close channel with his higher commitment transaction after a
4477 * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
4478 * out-of-band the other node operator to coordinate with him if option is available to you.
4479 * In any-case, choice is up to the user.
4481 MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(LDKChannelMonitor *this_arg, const LDKLogger *logger);
4483 void DecodeError_free(LDKDecodeError this_ptr);
4485 void Init_free(LDKInit this_ptr);
4487 void ErrorMessage_free(LDKErrorMessage this_ptr);
4490 * The channel ID involved in the error
4492 const uint8_t (*ErrorMessage_get_channel_id(const LDKErrorMessage *this_ptr))[32];
4495 * The channel ID involved in the error
4497 void ErrorMessage_set_channel_id(LDKErrorMessage *this_ptr, LDKThirtyTwoBytes val);
4500 * A possibly human-readable error description.
4501 * The string should be sanitized before it is used (e.g. emitted to logs
4502 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
4503 * vulnerability in the terminal emulator or the logging subsystem.
4505 LDKStr ErrorMessage_get_data(const LDKErrorMessage *this_ptr);
4508 * A possibly human-readable error description.
4509 * The string should be sanitized before it is used (e.g. emitted to logs
4510 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
4511 * vulnerability in the terminal emulator or the logging subsystem.
4513 void ErrorMessage_set_data(LDKErrorMessage *this_ptr, LDKCVec_u8Z val);
4515 MUST_USE_RES LDKErrorMessage ErrorMessage_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z data_arg);
4517 void Ping_free(LDKPing this_ptr);
4520 * The desired response length
4522 uint16_t Ping_get_ponglen(const LDKPing *this_ptr);
4525 * The desired response length
4527 void Ping_set_ponglen(LDKPing *this_ptr, uint16_t val);
4530 * The ping packet size.
4531 * This field is not sent on the wire. byteslen zeros are sent.
4533 uint16_t Ping_get_byteslen(const LDKPing *this_ptr);
4536 * The ping packet size.
4537 * This field is not sent on the wire. byteslen zeros are sent.
4539 void Ping_set_byteslen(LDKPing *this_ptr, uint16_t val);
4541 MUST_USE_RES LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
4543 void Pong_free(LDKPong this_ptr);
4546 * The pong packet size.
4547 * This field is not sent on the wire. byteslen zeros are sent.
4549 uint16_t Pong_get_byteslen(const LDKPong *this_ptr);
4552 * The pong packet size.
4553 * This field is not sent on the wire. byteslen zeros are sent.
4555 void Pong_set_byteslen(LDKPong *this_ptr, uint16_t val);
4557 MUST_USE_RES LDKPong Pong_new(uint16_t byteslen_arg);
4559 void OpenChannel_free(LDKOpenChannel this_ptr);
4562 * The genesis hash of the blockchain where the channel is to be opened
4564 const uint8_t (*OpenChannel_get_chain_hash(const LDKOpenChannel *this_ptr))[32];
4567 * The genesis hash of the blockchain where the channel is to be opened
4569 void OpenChannel_set_chain_hash(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val);
4572 * A temporary channel ID, until the funding outpoint is announced
4574 const uint8_t (*OpenChannel_get_temporary_channel_id(const LDKOpenChannel *this_ptr))[32];
4577 * A temporary channel ID, until the funding outpoint is announced
4579 void OpenChannel_set_temporary_channel_id(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val);
4584 uint64_t OpenChannel_get_funding_satoshis(const LDKOpenChannel *this_ptr);
4589 void OpenChannel_set_funding_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4592 * The amount to push to the counterparty as part of the open, in milli-satoshi
4594 uint64_t OpenChannel_get_push_msat(const LDKOpenChannel *this_ptr);
4597 * The amount to push to the counterparty as part of the open, in milli-satoshi
4599 void OpenChannel_set_push_msat(LDKOpenChannel *this_ptr, uint64_t val);
4602 * The threshold below which outputs on transactions broadcast by sender will be omitted
4604 uint64_t OpenChannel_get_dust_limit_satoshis(const LDKOpenChannel *this_ptr);
4607 * The threshold below which outputs on transactions broadcast by sender will be omitted
4609 void OpenChannel_set_dust_limit_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4612 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4614 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const LDKOpenChannel *this_ptr);
4617 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4619 void OpenChannel_set_max_htlc_value_in_flight_msat(LDKOpenChannel *this_ptr, uint64_t val);
4622 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4624 uint64_t OpenChannel_get_channel_reserve_satoshis(const LDKOpenChannel *this_ptr);
4627 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4629 void OpenChannel_set_channel_reserve_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4632 * The minimum HTLC size incoming to sender, in milli-satoshi
4634 uint64_t OpenChannel_get_htlc_minimum_msat(const LDKOpenChannel *this_ptr);
4637 * The minimum HTLC size incoming to sender, in milli-satoshi
4639 void OpenChannel_set_htlc_minimum_msat(LDKOpenChannel *this_ptr, uint64_t val);
4642 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
4644 uint32_t OpenChannel_get_feerate_per_kw(const LDKOpenChannel *this_ptr);
4647 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
4649 void OpenChannel_set_feerate_per_kw(LDKOpenChannel *this_ptr, uint32_t val);
4652 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4654 uint16_t OpenChannel_get_to_self_delay(const LDKOpenChannel *this_ptr);
4657 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4659 void OpenChannel_set_to_self_delay(LDKOpenChannel *this_ptr, uint16_t val);
4662 * The maximum number of inbound HTLCs towards sender
4664 uint16_t OpenChannel_get_max_accepted_htlcs(const LDKOpenChannel *this_ptr);
4667 * The maximum number of inbound HTLCs towards sender
4669 void OpenChannel_set_max_accepted_htlcs(LDKOpenChannel *this_ptr, uint16_t val);
4672 * The sender's key controlling the funding transaction
4674 LDKPublicKey OpenChannel_get_funding_pubkey(const LDKOpenChannel *this_ptr);
4677 * The sender's key controlling the funding transaction
4679 void OpenChannel_set_funding_pubkey(LDKOpenChannel *this_ptr, LDKPublicKey val);
4682 * Used to derive a revocation key for transactions broadcast by counterparty
4684 LDKPublicKey OpenChannel_get_revocation_basepoint(const LDKOpenChannel *this_ptr);
4687 * Used to derive a revocation key for transactions broadcast by counterparty
4689 void OpenChannel_set_revocation_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4692 * A payment key to sender for transactions broadcast by counterparty
4694 LDKPublicKey OpenChannel_get_payment_point(const LDKOpenChannel *this_ptr);
4697 * A payment key to sender for transactions broadcast by counterparty
4699 void OpenChannel_set_payment_point(LDKOpenChannel *this_ptr, LDKPublicKey val);
4702 * Used to derive a payment key to sender for transactions broadcast by sender
4704 LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const LDKOpenChannel *this_ptr);
4707 * Used to derive a payment key to sender for transactions broadcast by sender
4709 void OpenChannel_set_delayed_payment_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4712 * Used to derive an HTLC payment key to sender
4714 LDKPublicKey OpenChannel_get_htlc_basepoint(const LDKOpenChannel *this_ptr);
4717 * Used to derive an HTLC payment key to sender
4719 void OpenChannel_set_htlc_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4722 * The first to-be-broadcast-by-sender transaction's per commitment point
4724 LDKPublicKey OpenChannel_get_first_per_commitment_point(const LDKOpenChannel *this_ptr);
4727 * The first to-be-broadcast-by-sender transaction's per commitment point
4729 void OpenChannel_set_first_per_commitment_point(LDKOpenChannel *this_ptr, LDKPublicKey val);
4734 uint8_t OpenChannel_get_channel_flags(const LDKOpenChannel *this_ptr);
4739 void OpenChannel_set_channel_flags(LDKOpenChannel *this_ptr, uint8_t val);
4741 void AcceptChannel_free(LDKAcceptChannel this_ptr);
4744 * A temporary channel ID, until the funding outpoint is announced
4746 const uint8_t (*AcceptChannel_get_temporary_channel_id(const LDKAcceptChannel *this_ptr))[32];
4749 * A temporary channel ID, until the funding outpoint is announced
4751 void AcceptChannel_set_temporary_channel_id(LDKAcceptChannel *this_ptr, LDKThirtyTwoBytes val);
4754 * The threshold below which outputs on transactions broadcast by sender will be omitted
4756 uint64_t AcceptChannel_get_dust_limit_satoshis(const LDKAcceptChannel *this_ptr);
4759 * The threshold below which outputs on transactions broadcast by sender will be omitted
4761 void AcceptChannel_set_dust_limit_satoshis(LDKAcceptChannel *this_ptr, uint64_t val);
4764 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4766 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const LDKAcceptChannel *this_ptr);
4769 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4771 void AcceptChannel_set_max_htlc_value_in_flight_msat(LDKAcceptChannel *this_ptr, uint64_t val);
4774 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4776 uint64_t AcceptChannel_get_channel_reserve_satoshis(const LDKAcceptChannel *this_ptr);
4779 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4781 void AcceptChannel_set_channel_reserve_satoshis(LDKAcceptChannel *this_ptr, uint64_t val);
4784 * The minimum HTLC size incoming to sender, in milli-satoshi
4786 uint64_t AcceptChannel_get_htlc_minimum_msat(const LDKAcceptChannel *this_ptr);
4789 * The minimum HTLC size incoming to sender, in milli-satoshi
4791 void AcceptChannel_set_htlc_minimum_msat(LDKAcceptChannel *this_ptr, uint64_t val);
4794 * Minimum depth of the funding transaction before the channel is considered open
4796 uint32_t AcceptChannel_get_minimum_depth(const LDKAcceptChannel *this_ptr);
4799 * Minimum depth of the funding transaction before the channel is considered open
4801 void AcceptChannel_set_minimum_depth(LDKAcceptChannel *this_ptr, uint32_t val);
4804 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4806 uint16_t AcceptChannel_get_to_self_delay(const LDKAcceptChannel *this_ptr);
4809 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4811 void AcceptChannel_set_to_self_delay(LDKAcceptChannel *this_ptr, uint16_t val);
4814 * The maximum number of inbound HTLCs towards sender
4816 uint16_t AcceptChannel_get_max_accepted_htlcs(const LDKAcceptChannel *this_ptr);
4819 * The maximum number of inbound HTLCs towards sender
4821 void AcceptChannel_set_max_accepted_htlcs(LDKAcceptChannel *this_ptr, uint16_t val);
4824 * The sender's key controlling the funding transaction
4826 LDKPublicKey AcceptChannel_get_funding_pubkey(const LDKAcceptChannel *this_ptr);
4829 * The sender's key controlling the funding transaction
4831 void AcceptChannel_set_funding_pubkey(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4834 * Used to derive a revocation key for transactions broadcast by counterparty
4836 LDKPublicKey AcceptChannel_get_revocation_basepoint(const LDKAcceptChannel *this_ptr);
4839 * Used to derive a revocation key for transactions broadcast by counterparty
4841 void AcceptChannel_set_revocation_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4844 * A payment key to sender for transactions broadcast by counterparty
4846 LDKPublicKey AcceptChannel_get_payment_point(const LDKAcceptChannel *this_ptr);
4849 * A payment key to sender for transactions broadcast by counterparty
4851 void AcceptChannel_set_payment_point(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4854 * Used to derive a payment key to sender for transactions broadcast by sender
4856 LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const LDKAcceptChannel *this_ptr);
4859 * Used to derive a payment key to sender for transactions broadcast by sender
4861 void AcceptChannel_set_delayed_payment_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4864 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
4866 LDKPublicKey AcceptChannel_get_htlc_basepoint(const LDKAcceptChannel *this_ptr);
4869 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
4871 void AcceptChannel_set_htlc_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4874 * The first to-be-broadcast-by-sender transaction's per commitment point
4876 LDKPublicKey AcceptChannel_get_first_per_commitment_point(const LDKAcceptChannel *this_ptr);
4879 * The first to-be-broadcast-by-sender transaction's per commitment point
4881 void AcceptChannel_set_first_per_commitment_point(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4883 void FundingCreated_free(LDKFundingCreated this_ptr);
4886 * A temporary channel ID, until the funding is established
4888 const uint8_t (*FundingCreated_get_temporary_channel_id(const LDKFundingCreated *this_ptr))[32];
4891 * A temporary channel ID, until the funding is established
4893 void FundingCreated_set_temporary_channel_id(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val);
4896 * The funding transaction ID
4898 const uint8_t (*FundingCreated_get_funding_txid(const LDKFundingCreated *this_ptr))[32];
4901 * The funding transaction ID
4903 void FundingCreated_set_funding_txid(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val);
4906 * The specific output index funding this channel
4908 uint16_t FundingCreated_get_funding_output_index(const LDKFundingCreated *this_ptr);
4911 * The specific output index funding this channel
4913 void FundingCreated_set_funding_output_index(LDKFundingCreated *this_ptr, uint16_t val);
4916 * The signature of the channel initiator (funder) on the funding transaction
4918 LDKSignature FundingCreated_get_signature(const LDKFundingCreated *this_ptr);
4921 * The signature of the channel initiator (funder) on the funding transaction
4923 void FundingCreated_set_signature(LDKFundingCreated *this_ptr, LDKSignature val);
4925 MUST_USE_RES LDKFundingCreated FundingCreated_new(LDKThirtyTwoBytes temporary_channel_id_arg, LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, LDKSignature signature_arg);
4927 void FundingSigned_free(LDKFundingSigned this_ptr);
4932 const uint8_t (*FundingSigned_get_channel_id(const LDKFundingSigned *this_ptr))[32];
4937 void FundingSigned_set_channel_id(LDKFundingSigned *this_ptr, LDKThirtyTwoBytes val);
4940 * The signature of the channel acceptor (fundee) on the funding transaction
4942 LDKSignature FundingSigned_get_signature(const LDKFundingSigned *this_ptr);
4945 * The signature of the channel acceptor (fundee) on the funding transaction
4947 void FundingSigned_set_signature(LDKFundingSigned *this_ptr, LDKSignature val);
4949 MUST_USE_RES LDKFundingSigned FundingSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg);
4951 void FundingLocked_free(LDKFundingLocked this_ptr);
4956 const uint8_t (*FundingLocked_get_channel_id(const LDKFundingLocked *this_ptr))[32];
4961 void FundingLocked_set_channel_id(LDKFundingLocked *this_ptr, LDKThirtyTwoBytes val);
4964 * The per-commitment point of the second commitment transaction
4966 LDKPublicKey FundingLocked_get_next_per_commitment_point(const LDKFundingLocked *this_ptr);
4969 * The per-commitment point of the second commitment transaction
4971 void FundingLocked_set_next_per_commitment_point(LDKFundingLocked *this_ptr, LDKPublicKey val);
4973 MUST_USE_RES LDKFundingLocked FundingLocked_new(LDKThirtyTwoBytes channel_id_arg, LDKPublicKey next_per_commitment_point_arg);
4975 void Shutdown_free(LDKShutdown this_ptr);
4980 const uint8_t (*Shutdown_get_channel_id(const LDKShutdown *this_ptr))[32];
4985 void Shutdown_set_channel_id(LDKShutdown *this_ptr, LDKThirtyTwoBytes val);
4988 * The destination of this peer's funds on closing.
4989 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
4991 LDKu8slice Shutdown_get_scriptpubkey(const LDKShutdown *this_ptr);
4994 * The destination of this peer's funds on closing.
4995 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
4997 void Shutdown_set_scriptpubkey(LDKShutdown *this_ptr, LDKCVec_u8Z val);
4999 MUST_USE_RES LDKShutdown Shutdown_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z scriptpubkey_arg);
5001 void ClosingSigned_free(LDKClosingSigned this_ptr);
5006 const uint8_t (*ClosingSigned_get_channel_id(const LDKClosingSigned *this_ptr))[32];
5011 void ClosingSigned_set_channel_id(LDKClosingSigned *this_ptr, LDKThirtyTwoBytes val);
5014 * The proposed total fee for the closing transaction
5016 uint64_t ClosingSigned_get_fee_satoshis(const LDKClosingSigned *this_ptr);
5019 * The proposed total fee for the closing transaction
5021 void ClosingSigned_set_fee_satoshis(LDKClosingSigned *this_ptr, uint64_t val);
5024 * A signature on the closing transaction
5026 LDKSignature ClosingSigned_get_signature(const LDKClosingSigned *this_ptr);
5029 * A signature on the closing transaction
5031 void ClosingSigned_set_signature(LDKClosingSigned *this_ptr, LDKSignature val);
5033 MUST_USE_RES LDKClosingSigned ClosingSigned_new(LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, LDKSignature signature_arg);
5035 void UpdateAddHTLC_free(LDKUpdateAddHTLC this_ptr);
5040 const uint8_t (*UpdateAddHTLC_get_channel_id(const LDKUpdateAddHTLC *this_ptr))[32];
5045 void UpdateAddHTLC_set_channel_id(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val);
5050 uint64_t UpdateAddHTLC_get_htlc_id(const LDKUpdateAddHTLC *this_ptr);
5055 void UpdateAddHTLC_set_htlc_id(LDKUpdateAddHTLC *this_ptr, uint64_t val);
5058 * The HTLC value in milli-satoshi
5060 uint64_t UpdateAddHTLC_get_amount_msat(const LDKUpdateAddHTLC *this_ptr);
5063 * The HTLC value in milli-satoshi
5065 void UpdateAddHTLC_set_amount_msat(LDKUpdateAddHTLC *this_ptr, uint64_t val);
5068 * The payment hash, the pre-image of which controls HTLC redemption
5070 const uint8_t (*UpdateAddHTLC_get_payment_hash(const LDKUpdateAddHTLC *this_ptr))[32];
5073 * The payment hash, the pre-image of which controls HTLC redemption
5075 void UpdateAddHTLC_set_payment_hash(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val);
5078 * The expiry height of the HTLC
5080 uint32_t UpdateAddHTLC_get_cltv_expiry(const LDKUpdateAddHTLC *this_ptr);
5083 * The expiry height of the HTLC
5085 void UpdateAddHTLC_set_cltv_expiry(LDKUpdateAddHTLC *this_ptr, uint32_t val);
5087 void UpdateFulfillHTLC_free(LDKUpdateFulfillHTLC this_ptr);
5092 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const LDKUpdateFulfillHTLC *this_ptr))[32];
5097 void UpdateFulfillHTLC_set_channel_id(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val);
5102 uint64_t UpdateFulfillHTLC_get_htlc_id(const LDKUpdateFulfillHTLC *this_ptr);
5107 void UpdateFulfillHTLC_set_htlc_id(LDKUpdateFulfillHTLC *this_ptr, uint64_t val);
5110 * The pre-image of the payment hash, allowing HTLC redemption
5112 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const LDKUpdateFulfillHTLC *this_ptr))[32];
5115 * The pre-image of the payment hash, allowing HTLC redemption
5117 void UpdateFulfillHTLC_set_payment_preimage(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val);
5119 MUST_USE_RES LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, LDKThirtyTwoBytes payment_preimage_arg);
5121 void UpdateFailHTLC_free(LDKUpdateFailHTLC this_ptr);
5126 const uint8_t (*UpdateFailHTLC_get_channel_id(const LDKUpdateFailHTLC *this_ptr))[32];
5131 void UpdateFailHTLC_set_channel_id(LDKUpdateFailHTLC *this_ptr, LDKThirtyTwoBytes val);
5136 uint64_t UpdateFailHTLC_get_htlc_id(const LDKUpdateFailHTLC *this_ptr);
5141 void UpdateFailHTLC_set_htlc_id(LDKUpdateFailHTLC *this_ptr, uint64_t val);
5143 void UpdateFailMalformedHTLC_free(LDKUpdateFailMalformedHTLC this_ptr);
5148 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const LDKUpdateFailMalformedHTLC *this_ptr))[32];
5153 void UpdateFailMalformedHTLC_set_channel_id(LDKUpdateFailMalformedHTLC *this_ptr, LDKThirtyTwoBytes val);
5158 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const LDKUpdateFailMalformedHTLC *this_ptr);
5163 void UpdateFailMalformedHTLC_set_htlc_id(LDKUpdateFailMalformedHTLC *this_ptr, uint64_t val);
5168 uint16_t UpdateFailMalformedHTLC_get_failure_code(const LDKUpdateFailMalformedHTLC *this_ptr);
5173 void UpdateFailMalformedHTLC_set_failure_code(LDKUpdateFailMalformedHTLC *this_ptr, uint16_t val);
5175 void CommitmentSigned_free(LDKCommitmentSigned this_ptr);
5180 const uint8_t (*CommitmentSigned_get_channel_id(const LDKCommitmentSigned *this_ptr))[32];
5185 void CommitmentSigned_set_channel_id(LDKCommitmentSigned *this_ptr, LDKThirtyTwoBytes val);
5188 * A signature on the commitment transaction
5190 LDKSignature CommitmentSigned_get_signature(const LDKCommitmentSigned *this_ptr);
5193 * A signature on the commitment transaction
5195 void CommitmentSigned_set_signature(LDKCommitmentSigned *this_ptr, LDKSignature val);
5198 * Signatures on the HTLC transactions
5200 void CommitmentSigned_set_htlc_signatures(LDKCommitmentSigned *this_ptr, LDKCVec_SignatureZ val);
5202 MUST_USE_RES LDKCommitmentSigned CommitmentSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg, LDKCVec_SignatureZ htlc_signatures_arg);
5204 void RevokeAndACK_free(LDKRevokeAndACK this_ptr);
5209 const uint8_t (*RevokeAndACK_get_channel_id(const LDKRevokeAndACK *this_ptr))[32];
5214 void RevokeAndACK_set_channel_id(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val);
5217 * The secret corresponding to the per-commitment point
5219 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const LDKRevokeAndACK *this_ptr))[32];
5222 * The secret corresponding to the per-commitment point
5224 void RevokeAndACK_set_per_commitment_secret(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val);
5227 * The next sender-broadcast commitment transaction's per-commitment point
5229 LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const LDKRevokeAndACK *this_ptr);
5232 * The next sender-broadcast commitment transaction's per-commitment point
5234 void RevokeAndACK_set_next_per_commitment_point(LDKRevokeAndACK *this_ptr, LDKPublicKey val);
5236 MUST_USE_RES LDKRevokeAndACK RevokeAndACK_new(LDKThirtyTwoBytes channel_id_arg, LDKThirtyTwoBytes per_commitment_secret_arg, LDKPublicKey next_per_commitment_point_arg);
5238 void UpdateFee_free(LDKUpdateFee this_ptr);
5243 const uint8_t (*UpdateFee_get_channel_id(const LDKUpdateFee *this_ptr))[32];
5248 void UpdateFee_set_channel_id(LDKUpdateFee *this_ptr, LDKThirtyTwoBytes val);
5251 * Fee rate per 1000-weight of the transaction
5253 uint32_t UpdateFee_get_feerate_per_kw(const LDKUpdateFee *this_ptr);
5256 * Fee rate per 1000-weight of the transaction
5258 void UpdateFee_set_feerate_per_kw(LDKUpdateFee *this_ptr, uint32_t val);
5260 MUST_USE_RES LDKUpdateFee UpdateFee_new(LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
5262 void DataLossProtect_free(LDKDataLossProtect this_ptr);
5265 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5266 * belonging to the recipient
5268 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const LDKDataLossProtect *this_ptr))[32];
5271 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5272 * belonging to the recipient
5274 void DataLossProtect_set_your_last_per_commitment_secret(LDKDataLossProtect *this_ptr, LDKThirtyTwoBytes val);
5277 * The sender's per-commitment point for their current commitment transaction
5279 LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const LDKDataLossProtect *this_ptr);
5282 * The sender's per-commitment point for their current commitment transaction
5284 void DataLossProtect_set_my_current_per_commitment_point(LDKDataLossProtect *this_ptr, LDKPublicKey val);
5286 MUST_USE_RES LDKDataLossProtect DataLossProtect_new(LDKThirtyTwoBytes your_last_per_commitment_secret_arg, LDKPublicKey my_current_per_commitment_point_arg);
5288 void ChannelReestablish_free(LDKChannelReestablish this_ptr);
5293 const uint8_t (*ChannelReestablish_get_channel_id(const LDKChannelReestablish *this_ptr))[32];
5298 void ChannelReestablish_set_channel_id(LDKChannelReestablish *this_ptr, LDKThirtyTwoBytes val);
5301 * The next commitment number for the sender
5303 uint64_t ChannelReestablish_get_next_local_commitment_number(const LDKChannelReestablish *this_ptr);
5306 * The next commitment number for the sender
5308 void ChannelReestablish_set_next_local_commitment_number(LDKChannelReestablish *this_ptr, uint64_t val);
5311 * The next commitment number for the recipient
5313 uint64_t ChannelReestablish_get_next_remote_commitment_number(const LDKChannelReestablish *this_ptr);
5316 * The next commitment number for the recipient
5318 void ChannelReestablish_set_next_remote_commitment_number(LDKChannelReestablish *this_ptr, uint64_t val);
5320 void AnnouncementSignatures_free(LDKAnnouncementSignatures this_ptr);
5325 const uint8_t (*AnnouncementSignatures_get_channel_id(const LDKAnnouncementSignatures *this_ptr))[32];
5330 void AnnouncementSignatures_set_channel_id(LDKAnnouncementSignatures *this_ptr, LDKThirtyTwoBytes val);
5333 * The short channel ID
5335 uint64_t AnnouncementSignatures_get_short_channel_id(const LDKAnnouncementSignatures *this_ptr);
5338 * The short channel ID
5340 void AnnouncementSignatures_set_short_channel_id(LDKAnnouncementSignatures *this_ptr, uint64_t val);
5343 * A signature by the node key
5345 LDKSignature AnnouncementSignatures_get_node_signature(const LDKAnnouncementSignatures *this_ptr);
5348 * A signature by the node key
5350 void AnnouncementSignatures_set_node_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val);
5353 * A signature by the funding key
5355 LDKSignature AnnouncementSignatures_get_bitcoin_signature(const LDKAnnouncementSignatures *this_ptr);
5358 * A signature by the funding key
5360 void AnnouncementSignatures_set_bitcoin_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val);
5362 MUST_USE_RES LDKAnnouncementSignatures AnnouncementSignatures_new(LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, LDKSignature node_signature_arg, LDKSignature bitcoin_signature_arg);
5364 void NetAddress_free(LDKNetAddress this_ptr);
5366 void UnsignedNodeAnnouncement_free(LDKUnsignedNodeAnnouncement this_ptr);
5369 * A strictly monotonic announcement counter, with gaps allowed
5371 uint32_t UnsignedNodeAnnouncement_get_timestamp(const LDKUnsignedNodeAnnouncement *this_ptr);
5374 * A strictly monotonic announcement counter, with gaps allowed
5376 void UnsignedNodeAnnouncement_set_timestamp(LDKUnsignedNodeAnnouncement *this_ptr, uint32_t val);
5379 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
5382 LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const LDKUnsignedNodeAnnouncement *this_ptr);
5385 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
5388 void UnsignedNodeAnnouncement_set_node_id(LDKUnsignedNodeAnnouncement *this_ptr, LDKPublicKey val);
5391 * An RGB color for UI purposes
5393 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const LDKUnsignedNodeAnnouncement *this_ptr))[3];
5396 * An RGB color for UI purposes
5398 void UnsignedNodeAnnouncement_set_rgb(LDKUnsignedNodeAnnouncement *this_ptr, LDKThreeBytes val);
5401 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
5404 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const LDKUnsignedNodeAnnouncement *this_ptr))[32];
5407 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
5410 void UnsignedNodeAnnouncement_set_alias(LDKUnsignedNodeAnnouncement *this_ptr, LDKThirtyTwoBytes val);
5413 * List of addresses on which this node is reachable
5415 void UnsignedNodeAnnouncement_set_addresses(LDKUnsignedNodeAnnouncement *this_ptr, LDKCVec_NetAddressZ val);
5417 void NodeAnnouncement_free(LDKNodeAnnouncement this_ptr);
5420 * The signature by the node key
5422 LDKSignature NodeAnnouncement_get_signature(const LDKNodeAnnouncement *this_ptr);
5425 * The signature by the node key
5427 void NodeAnnouncement_set_signature(LDKNodeAnnouncement *this_ptr, LDKSignature val);
5430 * The actual content of the announcement
5432 LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const LDKNodeAnnouncement *this_ptr);
5435 * The actual content of the announcement
5437 void NodeAnnouncement_set_contents(LDKNodeAnnouncement *this_ptr, LDKUnsignedNodeAnnouncement val);
5439 MUST_USE_RES LDKNodeAnnouncement NodeAnnouncement_new(LDKSignature signature_arg, LDKUnsignedNodeAnnouncement contents_arg);
5441 void UnsignedChannelAnnouncement_free(LDKUnsignedChannelAnnouncement this_ptr);
5444 * The genesis hash of the blockchain where the channel is to be opened
5446 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const LDKUnsignedChannelAnnouncement *this_ptr))[32];
5449 * The genesis hash of the blockchain where the channel is to be opened
5451 void UnsignedChannelAnnouncement_set_chain_hash(LDKUnsignedChannelAnnouncement *this_ptr, LDKThirtyTwoBytes val);
5454 * The short channel ID
5456 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const LDKUnsignedChannelAnnouncement *this_ptr);
5459 * The short channel ID
5461 void UnsignedChannelAnnouncement_set_short_channel_id(LDKUnsignedChannelAnnouncement *this_ptr, uint64_t val);
5464 * One of the two node_ids which are endpoints of this channel
5466 LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const LDKUnsignedChannelAnnouncement *this_ptr);
5469 * One of the two node_ids which are endpoints of this channel
5471 void UnsignedChannelAnnouncement_set_node_id_1(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5474 * The other of the two node_ids which are endpoints of this channel
5476 LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const LDKUnsignedChannelAnnouncement *this_ptr);
5479 * The other of the two node_ids which are endpoints of this channel
5481 void UnsignedChannelAnnouncement_set_node_id_2(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5484 * The funding key for the first node
5486 LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const LDKUnsignedChannelAnnouncement *this_ptr);
5489 * The funding key for the first node
5491 void UnsignedChannelAnnouncement_set_bitcoin_key_1(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5494 * The funding key for the second node
5496 LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const LDKUnsignedChannelAnnouncement *this_ptr);
5499 * The funding key for the second node
5501 void UnsignedChannelAnnouncement_set_bitcoin_key_2(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5503 void ChannelAnnouncement_free(LDKChannelAnnouncement this_ptr);
5506 * Authentication of the announcement by the first public node
5508 LDKSignature ChannelAnnouncement_get_node_signature_1(const LDKChannelAnnouncement *this_ptr);
5511 * Authentication of the announcement by the first public node
5513 void ChannelAnnouncement_set_node_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5516 * Authentication of the announcement by the second public node
5518 LDKSignature ChannelAnnouncement_get_node_signature_2(const LDKChannelAnnouncement *this_ptr);
5521 * Authentication of the announcement by the second public node
5523 void ChannelAnnouncement_set_node_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5526 * Proof of funding UTXO ownership by the first public node
5528 LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const LDKChannelAnnouncement *this_ptr);
5531 * Proof of funding UTXO ownership by the first public node
5533 void ChannelAnnouncement_set_bitcoin_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5536 * Proof of funding UTXO ownership by the second public node
5538 LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const LDKChannelAnnouncement *this_ptr);
5541 * Proof of funding UTXO ownership by the second public node
5543 void ChannelAnnouncement_set_bitcoin_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5546 * The actual announcement
5548 LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const LDKChannelAnnouncement *this_ptr);
5551 * The actual announcement
5553 void ChannelAnnouncement_set_contents(LDKChannelAnnouncement *this_ptr, LDKUnsignedChannelAnnouncement val);
5555 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);
5557 void UnsignedChannelUpdate_free(LDKUnsignedChannelUpdate this_ptr);
5560 * The genesis hash of the blockchain where the channel is to be opened
5562 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const LDKUnsignedChannelUpdate *this_ptr))[32];
5565 * The genesis hash of the blockchain where the channel is to be opened
5567 void UnsignedChannelUpdate_set_chain_hash(LDKUnsignedChannelUpdate *this_ptr, LDKThirtyTwoBytes val);
5570 * The short channel ID
5572 uint64_t UnsignedChannelUpdate_get_short_channel_id(const LDKUnsignedChannelUpdate *this_ptr);
5575 * The short channel ID
5577 void UnsignedChannelUpdate_set_short_channel_id(LDKUnsignedChannelUpdate *this_ptr, uint64_t val);
5580 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
5582 uint32_t UnsignedChannelUpdate_get_timestamp(const LDKUnsignedChannelUpdate *this_ptr);
5585 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
5587 void UnsignedChannelUpdate_set_timestamp(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5592 uint8_t UnsignedChannelUpdate_get_flags(const LDKUnsignedChannelUpdate *this_ptr);
5597 void UnsignedChannelUpdate_set_flags(LDKUnsignedChannelUpdate *this_ptr, uint8_t val);
5600 * The number of blocks to subtract from incoming HTLC cltv_expiry values
5602 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const LDKUnsignedChannelUpdate *this_ptr);
5605 * The number of blocks to subtract from incoming HTLC cltv_expiry values
5607 void UnsignedChannelUpdate_set_cltv_expiry_delta(LDKUnsignedChannelUpdate *this_ptr, uint16_t val);
5610 * The minimum HTLC size incoming to sender, in milli-satoshi
5612 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const LDKUnsignedChannelUpdate *this_ptr);
5615 * The minimum HTLC size incoming to sender, in milli-satoshi
5617 void UnsignedChannelUpdate_set_htlc_minimum_msat(LDKUnsignedChannelUpdate *this_ptr, uint64_t val);
5620 * The base HTLC fee charged by sender, in milli-satoshi
5622 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const LDKUnsignedChannelUpdate *this_ptr);
5625 * The base HTLC fee charged by sender, in milli-satoshi
5627 void UnsignedChannelUpdate_set_fee_base_msat(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5630 * The amount to fee multiplier, in micro-satoshi
5632 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const LDKUnsignedChannelUpdate *this_ptr);
5635 * The amount to fee multiplier, in micro-satoshi
5637 void UnsignedChannelUpdate_set_fee_proportional_millionths(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5639 void ChannelUpdate_free(LDKChannelUpdate this_ptr);
5642 * A signature of the channel update
5644 LDKSignature ChannelUpdate_get_signature(const LDKChannelUpdate *this_ptr);
5647 * A signature of the channel update
5649 void ChannelUpdate_set_signature(LDKChannelUpdate *this_ptr, LDKSignature val);
5652 * The actual channel update
5654 LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const LDKChannelUpdate *this_ptr);
5657 * The actual channel update
5659 void ChannelUpdate_set_contents(LDKChannelUpdate *this_ptr, LDKUnsignedChannelUpdate val);
5661 MUST_USE_RES LDKChannelUpdate ChannelUpdate_new(LDKSignature signature_arg, LDKUnsignedChannelUpdate contents_arg);
5663 void QueryChannelRange_free(LDKQueryChannelRange this_ptr);
5666 * The genesis hash of the blockchain being queried
5668 const uint8_t (*QueryChannelRange_get_chain_hash(const LDKQueryChannelRange *this_ptr))[32];
5671 * The genesis hash of the blockchain being queried
5673 void QueryChannelRange_set_chain_hash(LDKQueryChannelRange *this_ptr, LDKThirtyTwoBytes val);
5676 * The height of the first block for the channel UTXOs being queried
5678 uint32_t QueryChannelRange_get_first_blocknum(const LDKQueryChannelRange *this_ptr);
5681 * The height of the first block for the channel UTXOs being queried
5683 void QueryChannelRange_set_first_blocknum(LDKQueryChannelRange *this_ptr, uint32_t val);
5686 * The number of blocks to include in the query results
5688 uint32_t QueryChannelRange_get_number_of_blocks(const LDKQueryChannelRange *this_ptr);
5691 * The number of blocks to include in the query results
5693 void QueryChannelRange_set_number_of_blocks(LDKQueryChannelRange *this_ptr, uint32_t val);
5695 MUST_USE_RES LDKQueryChannelRange QueryChannelRange_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
5697 void ReplyChannelRange_free(LDKReplyChannelRange this_ptr);
5700 * The genesis hash of the blockchain being queried
5702 const uint8_t (*ReplyChannelRange_get_chain_hash(const LDKReplyChannelRange *this_ptr))[32];
5705 * The genesis hash of the blockchain being queried
5707 void ReplyChannelRange_set_chain_hash(LDKReplyChannelRange *this_ptr, LDKThirtyTwoBytes val);
5710 * The height of the first block in the range of the reply
5712 uint32_t ReplyChannelRange_get_first_blocknum(const LDKReplyChannelRange *this_ptr);
5715 * The height of the first block in the range of the reply
5717 void ReplyChannelRange_set_first_blocknum(LDKReplyChannelRange *this_ptr, uint32_t val);
5720 * The number of blocks included in the range of the reply
5722 uint32_t ReplyChannelRange_get_number_of_blocks(const LDKReplyChannelRange *this_ptr);
5725 * The number of blocks included in the range of the reply
5727 void ReplyChannelRange_set_number_of_blocks(LDKReplyChannelRange *this_ptr, uint32_t val);
5730 * Indicates if the query recipient maintains up-to-date channel
5731 * information for the chain_hash
5733 bool ReplyChannelRange_get_full_information(const LDKReplyChannelRange *this_ptr);
5736 * Indicates if the query recipient maintains up-to-date channel
5737 * information for the chain_hash
5739 void ReplyChannelRange_set_full_information(LDKReplyChannelRange *this_ptr, bool val);
5742 * The short_channel_ids in the channel range
5744 void ReplyChannelRange_set_short_channel_ids(LDKReplyChannelRange *this_ptr, LDKCVec_u64Z val);
5746 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);
5748 void QueryShortChannelIds_free(LDKQueryShortChannelIds this_ptr);
5751 * The genesis hash of the blockchain being queried
5753 const uint8_t (*QueryShortChannelIds_get_chain_hash(const LDKQueryShortChannelIds *this_ptr))[32];
5756 * The genesis hash of the blockchain being queried
5758 void QueryShortChannelIds_set_chain_hash(LDKQueryShortChannelIds *this_ptr, LDKThirtyTwoBytes val);
5761 * The short_channel_ids that are being queried
5763 void QueryShortChannelIds_set_short_channel_ids(LDKQueryShortChannelIds *this_ptr, LDKCVec_u64Z val);
5765 MUST_USE_RES LDKQueryShortChannelIds QueryShortChannelIds_new(LDKThirtyTwoBytes chain_hash_arg, LDKCVec_u64Z short_channel_ids_arg);
5767 void ReplyShortChannelIdsEnd_free(LDKReplyShortChannelIdsEnd this_ptr);
5770 * The genesis hash of the blockchain that was queried
5772 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const LDKReplyShortChannelIdsEnd *this_ptr))[32];
5775 * The genesis hash of the blockchain that was queried
5777 void ReplyShortChannelIdsEnd_set_chain_hash(LDKReplyShortChannelIdsEnd *this_ptr, LDKThirtyTwoBytes val);
5780 * Indicates if the query recipient maintains up-to-date channel
5781 * information for the chain_hash
5783 bool ReplyShortChannelIdsEnd_get_full_information(const LDKReplyShortChannelIdsEnd *this_ptr);
5786 * Indicates if the query recipient maintains up-to-date channel
5787 * information for the chain_hash
5789 void ReplyShortChannelIdsEnd_set_full_information(LDKReplyShortChannelIdsEnd *this_ptr, bool val);
5791 MUST_USE_RES LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
5793 void GossipTimestampFilter_free(LDKGossipTimestampFilter this_ptr);
5796 * The genesis hash of the blockchain for channel and node information
5798 const uint8_t (*GossipTimestampFilter_get_chain_hash(const LDKGossipTimestampFilter *this_ptr))[32];
5801 * The genesis hash of the blockchain for channel and node information
5803 void GossipTimestampFilter_set_chain_hash(LDKGossipTimestampFilter *this_ptr, LDKThirtyTwoBytes val);
5806 * The starting unix timestamp
5808 uint32_t GossipTimestampFilter_get_first_timestamp(const LDKGossipTimestampFilter *this_ptr);
5811 * The starting unix timestamp
5813 void GossipTimestampFilter_set_first_timestamp(LDKGossipTimestampFilter *this_ptr, uint32_t val);
5816 * The range of information in seconds
5818 uint32_t GossipTimestampFilter_get_timestamp_range(const LDKGossipTimestampFilter *this_ptr);
5821 * The range of information in seconds
5823 void GossipTimestampFilter_set_timestamp_range(LDKGossipTimestampFilter *this_ptr, uint32_t val);
5825 MUST_USE_RES LDKGossipTimestampFilter GossipTimestampFilter_new(LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
5827 void ErrorAction_free(LDKErrorAction this_ptr);
5829 void LightningError_free(LDKLightningError this_ptr);
5832 * A human-readable message describing the error
5834 LDKStr LightningError_get_err(const LDKLightningError *this_ptr);
5837 * A human-readable message describing the error
5839 void LightningError_set_err(LDKLightningError *this_ptr, LDKCVec_u8Z val);
5842 * The action which should be taken against the offending peer.
5844 LDKErrorAction LightningError_get_action(const LDKLightningError *this_ptr);
5847 * The action which should be taken against the offending peer.
5849 void LightningError_set_action(LDKLightningError *this_ptr, LDKErrorAction val);
5851 MUST_USE_RES LDKLightningError LightningError_new(LDKCVec_u8Z err_arg, LDKErrorAction action_arg);
5853 void CommitmentUpdate_free(LDKCommitmentUpdate this_ptr);
5856 * update_add_htlc messages which should be sent
5858 void CommitmentUpdate_set_update_add_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateAddHTLCZ val);
5861 * update_fulfill_htlc messages which should be sent
5863 void CommitmentUpdate_set_update_fulfill_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFulfillHTLCZ val);
5866 * update_fail_htlc messages which should be sent
5868 void CommitmentUpdate_set_update_fail_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFailHTLCZ val);
5871 * update_fail_malformed_htlc messages which should be sent
5873 void CommitmentUpdate_set_update_fail_malformed_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFailMalformedHTLCZ val);
5876 * An update_fee message which should be sent
5878 LDKUpdateFee CommitmentUpdate_get_update_fee(const LDKCommitmentUpdate *this_ptr);
5881 * An update_fee message which should be sent
5883 void CommitmentUpdate_set_update_fee(LDKCommitmentUpdate *this_ptr, LDKUpdateFee val);
5886 * Finally, the commitment_signed message which should be sent
5888 LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const LDKCommitmentUpdate *this_ptr);
5891 * Finally, the commitment_signed message which should be sent
5893 void CommitmentUpdate_set_commitment_signed(LDKCommitmentUpdate *this_ptr, LDKCommitmentSigned val);
5895 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);
5897 void HTLCFailChannelUpdate_free(LDKHTLCFailChannelUpdate this_ptr);
5900 * Calls the free function if one is set
5902 void ChannelMessageHandler_free(LDKChannelMessageHandler this_ptr);
5905 * Calls the free function if one is set
5907 void RoutingMessageHandler_free(LDKRoutingMessageHandler this_ptr);
5909 LDKCVec_u8Z AcceptChannel_write(const LDKAcceptChannel *obj);
5911 LDKAcceptChannel AcceptChannel_read(LDKu8slice ser);
5913 LDKCVec_u8Z AnnouncementSignatures_write(const LDKAnnouncementSignatures *obj);
5915 LDKAnnouncementSignatures AnnouncementSignatures_read(LDKu8slice ser);
5917 LDKCVec_u8Z ChannelReestablish_write(const LDKChannelReestablish *obj);
5919 LDKChannelReestablish ChannelReestablish_read(LDKu8slice ser);
5921 LDKCVec_u8Z ClosingSigned_write(const LDKClosingSigned *obj);
5923 LDKClosingSigned ClosingSigned_read(LDKu8slice ser);
5925 LDKCVec_u8Z CommitmentSigned_write(const LDKCommitmentSigned *obj);
5927 LDKCommitmentSigned CommitmentSigned_read(LDKu8slice ser);
5929 LDKCVec_u8Z FundingCreated_write(const LDKFundingCreated *obj);
5931 LDKFundingCreated FundingCreated_read(LDKu8slice ser);
5933 LDKCVec_u8Z FundingSigned_write(const LDKFundingSigned *obj);
5935 LDKFundingSigned FundingSigned_read(LDKu8slice ser);
5937 LDKCVec_u8Z FundingLocked_write(const LDKFundingLocked *obj);
5939 LDKFundingLocked FundingLocked_read(LDKu8slice ser);
5941 LDKCVec_u8Z Init_write(const LDKInit *obj);
5943 LDKInit Init_read(LDKu8slice ser);
5945 LDKCVec_u8Z OpenChannel_write(const LDKOpenChannel *obj);
5947 LDKOpenChannel OpenChannel_read(LDKu8slice ser);
5949 LDKCVec_u8Z RevokeAndACK_write(const LDKRevokeAndACK *obj);
5951 LDKRevokeAndACK RevokeAndACK_read(LDKu8slice ser);
5953 LDKCVec_u8Z Shutdown_write(const LDKShutdown *obj);
5955 LDKShutdown Shutdown_read(LDKu8slice ser);
5957 LDKCVec_u8Z UpdateFailHTLC_write(const LDKUpdateFailHTLC *obj);
5959 LDKUpdateFailHTLC UpdateFailHTLC_read(LDKu8slice ser);
5961 LDKCVec_u8Z UpdateFailMalformedHTLC_write(const LDKUpdateFailMalformedHTLC *obj);
5963 LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(LDKu8slice ser);
5965 LDKCVec_u8Z UpdateFee_write(const LDKUpdateFee *obj);
5967 LDKUpdateFee UpdateFee_read(LDKu8slice ser);
5969 LDKCVec_u8Z UpdateFulfillHTLC_write(const LDKUpdateFulfillHTLC *obj);
5971 LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(LDKu8slice ser);
5973 LDKCVec_u8Z UpdateAddHTLC_write(const LDKUpdateAddHTLC *obj);
5975 LDKUpdateAddHTLC UpdateAddHTLC_read(LDKu8slice ser);
5977 LDKCVec_u8Z Ping_write(const LDKPing *obj);
5979 LDKPing Ping_read(LDKu8slice ser);
5981 LDKCVec_u8Z Pong_write(const LDKPong *obj);
5983 LDKPong Pong_read(LDKu8slice ser);
5985 LDKCVec_u8Z UnsignedChannelAnnouncement_write(const LDKUnsignedChannelAnnouncement *obj);
5987 LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_read(LDKu8slice ser);
5989 LDKCVec_u8Z ChannelAnnouncement_write(const LDKChannelAnnouncement *obj);
5991 LDKChannelAnnouncement ChannelAnnouncement_read(LDKu8slice ser);
5993 LDKCVec_u8Z UnsignedChannelUpdate_write(const LDKUnsignedChannelUpdate *obj);
5995 LDKUnsignedChannelUpdate UnsignedChannelUpdate_read(LDKu8slice ser);
5997 LDKCVec_u8Z ChannelUpdate_write(const LDKChannelUpdate *obj);
5999 LDKChannelUpdate ChannelUpdate_read(LDKu8slice ser);
6001 LDKCVec_u8Z ErrorMessage_write(const LDKErrorMessage *obj);
6003 LDKErrorMessage ErrorMessage_read(LDKu8slice ser);
6005 LDKCVec_u8Z UnsignedNodeAnnouncement_write(const LDKUnsignedNodeAnnouncement *obj);
6007 LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_read(LDKu8slice ser);
6009 LDKCVec_u8Z NodeAnnouncement_write(const LDKNodeAnnouncement *obj);
6011 LDKNodeAnnouncement NodeAnnouncement_read(LDKu8slice ser);
6013 LDKQueryShortChannelIds QueryShortChannelIds_read(LDKu8slice ser);
6015 LDKCVec_u8Z QueryShortChannelIds_write(const LDKQueryShortChannelIds *obj);
6017 LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_read(LDKu8slice ser);
6019 LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const LDKReplyShortChannelIdsEnd *obj);
6021 LDKQueryChannelRange QueryChannelRange_read(LDKu8slice ser);
6023 LDKCVec_u8Z QueryChannelRange_write(const LDKQueryChannelRange *obj);
6025 LDKReplyChannelRange ReplyChannelRange_read(LDKu8slice ser);
6027 LDKCVec_u8Z ReplyChannelRange_write(const LDKReplyChannelRange *obj);
6029 LDKGossipTimestampFilter GossipTimestampFilter_read(LDKu8slice ser);
6031 LDKCVec_u8Z GossipTimestampFilter_write(const LDKGossipTimestampFilter *obj);
6033 void MessageHandler_free(LDKMessageHandler this_ptr);
6036 * A message handler which handles messages specific to channels. Usually this is just a
6037 * ChannelManager object.
6039 const LDKChannelMessageHandler *MessageHandler_get_chan_handler(const LDKMessageHandler *this_ptr);
6042 * A message handler which handles messages specific to channels. Usually this is just a
6043 * ChannelManager object.
6045 void MessageHandler_set_chan_handler(LDKMessageHandler *this_ptr, LDKChannelMessageHandler val);
6048 * A message handler which handles messages updating our knowledge of the network channel
6049 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6051 const LDKRoutingMessageHandler *MessageHandler_get_route_handler(const LDKMessageHandler *this_ptr);
6054 * A message handler which handles messages updating our knowledge of the network channel
6055 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6057 void MessageHandler_set_route_handler(LDKMessageHandler *this_ptr, LDKRoutingMessageHandler val);
6059 MUST_USE_RES LDKMessageHandler MessageHandler_new(LDKChannelMessageHandler chan_handler_arg, LDKRoutingMessageHandler route_handler_arg);
6062 * Calls the free function if one is set
6064 void SocketDescriptor_free(LDKSocketDescriptor this_ptr);
6066 void PeerHandleError_free(LDKPeerHandleError this_ptr);
6069 * Used to indicate that we probably can't make any future connections to this peer, implying
6070 * we should go ahead and force-close any channels we have with it.
6072 bool PeerHandleError_get_no_connection_possible(const LDKPeerHandleError *this_ptr);
6075 * Used to indicate that we probably can't make any future connections to this peer, implying
6076 * we should go ahead and force-close any channels we have with it.
6078 void PeerHandleError_set_no_connection_possible(LDKPeerHandleError *this_ptr, bool val);
6080 MUST_USE_RES LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
6082 void PeerManager_free(LDKPeerManager this_ptr);
6085 * Constructs a new PeerManager with the given message handlers and node_id secret key
6086 * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
6087 * cryptographically secure random bytes.
6089 MUST_USE_RES LDKPeerManager PeerManager_new(LDKMessageHandler message_handler, LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], LDKLogger logger);
6092 * Get the list of node ids for peers which have completed the initial handshake.
6094 * For outbound connections, this will be the same as the their_node_id parameter passed in to
6095 * new_outbound_connection, however entries will only appear once the initial handshake has
6096 * completed and we are sure the remote peer has the private key for the given node_id.
6098 MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const LDKPeerManager *this_arg);
6101 * Indicates a new outbound connection has been established to a node with the given node_id.
6102 * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
6103 * descriptor but must disconnect the connection immediately.
6105 * Returns a small number of bytes to send to the remote node (currently always 50).
6107 * Panics if descriptor is duplicative with some other descriptor which has not yet had a
6108 * socket_disconnected().
6110 MUST_USE_RES LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const LDKPeerManager *this_arg, LDKPublicKey their_node_id, LDKSocketDescriptor descriptor);
6113 * Indicates a new inbound connection has been established.
6115 * May refuse the connection by returning an Err, but will never write bytes to the remote end
6116 * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
6117 * call socket_disconnected for the new descriptor but must disconnect the connection
6120 * Panics if descriptor is duplicative with some other descriptor which has not yet had
6121 * socket_disconnected called.
6123 MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const LDKPeerManager *this_arg, LDKSocketDescriptor descriptor);
6126 * Indicates that there is room to write data to the given socket descriptor.
6128 * May return an Err to indicate that the connection should be closed.
6130 * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
6131 * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
6132 * invariants around calling write_buffer_space_avail in case a write did not fully complete
6133 * must still hold - be ready to call write_buffer_space_avail again if a write call generated
6134 * here isn't sufficient! Panics if the descriptor was not previously registered in a
6135 * new_\\*_connection event.
6137 MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const LDKPeerManager *this_arg, LDKSocketDescriptor *descriptor);
6140 * Indicates that data was read from the given socket descriptor.
6142 * May return an Err to indicate that the connection should be closed.
6144 * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
6145 * Thus, however, you almost certainly want to call process_events() after any read_event to
6146 * generate send_data calls to handle responses.
6148 * If Ok(true) is returned, further read_events should not be triggered until a send_data call
6149 * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
6151 * Panics if the descriptor was not previously registered in a new_*_connection event.
6153 MUST_USE_RES LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const LDKPeerManager *this_arg, LDKSocketDescriptor *peer_descriptor, LDKu8slice data);
6156 * Checks for any events generated by our handlers and processes them. Includes sending most
6157 * response messages as well as messages generated by calls to handler functions directly (eg
6158 * functions like ChannelManager::process_pending_htlc_forward or send_payment).
6160 void PeerManager_process_events(const LDKPeerManager *this_arg);
6163 * Indicates that the given socket descriptor's connection is now closed.
6165 * This must only be called if the socket has been disconnected by the peer or your own
6166 * decision to disconnect it and must NOT be called in any case where other parts of this
6167 * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
6170 * Panics if the descriptor was not previously registered in a successful new_*_connection event.
6172 void PeerManager_socket_disconnected(const LDKPeerManager *this_arg, const LDKSocketDescriptor *descriptor);
6175 * This function should be called roughly once every 30 seconds.
6176 * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
6177 * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
6179 void PeerManager_timer_tick_occured(const LDKPeerManager *this_arg);
6182 * Build the commitment secret from the seed and the commitment number
6184 LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
6187 * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
6188 * from the base secret and the per_commitment_point.
6190 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6191 * generated (ie our own).
6193 LDKCResult_SecretKeySecpErrorZ derive_private_key(LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
6196 * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
6197 * from the base point and the per_commitment_key. This is the public equivalent of
6198 * derive_private_key - using only public keys to derive a public key instead of private keys.
6200 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6201 * generated (ie our own).
6203 LDKCResult_PublicKeySecpErrorZ derive_public_key(LDKPublicKey per_commitment_point, LDKPublicKey base_point);
6206 * Derives a per-commitment-transaction revocation key from its constituent parts.
6208 * Only the cheating participant owns a valid witness to propagate a revoked
6209 * commitment transaction, thus per_commitment_secret always come from cheater
6210 * and revocation_base_secret always come from punisher, which is the broadcaster
6211 * of the transaction spending with this key knowledge.
6213 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6214 * generated (ie our own).
6216 LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
6219 * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
6220 * the public equivalend of derive_private_revocation_key - using only public keys to derive a
6221 * public key instead of private keys.
6223 * Only the cheating participant owns a valid witness to propagate a revoked
6224 * commitment transaction, thus per_commitment_point always come from cheater
6225 * and revocation_base_point always come from punisher, which is the broadcaster
6226 * of the transaction spending with this key knowledge.
6228 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
6229 * generated (ie our own).
6231 LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(LDKPublicKey per_commitment_point, LDKPublicKey countersignatory_revocation_base_point);
6233 void TxCreationKeys_free(LDKTxCreationKeys this_ptr);
6236 * The broadcaster's per-commitment public key which was used to derive the other keys.
6238 LDKPublicKey TxCreationKeys_get_per_commitment_point(const LDKTxCreationKeys *this_ptr);
6241 * The broadcaster's per-commitment public key which was used to derive the other keys.
6243 void TxCreationKeys_set_per_commitment_point(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6246 * The revocation key which is used to allow the broadcaster of the commitment
6247 * transaction to provide their counterparty the ability to punish them if they broadcast
6250 LDKPublicKey TxCreationKeys_get_revocation_key(const LDKTxCreationKeys *this_ptr);
6253 * The revocation key which is used to allow the broadcaster of the commitment
6254 * transaction to provide their counterparty the ability to punish them if they broadcast
6257 void TxCreationKeys_set_revocation_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6260 * Broadcaster's HTLC Key
6262 LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const LDKTxCreationKeys *this_ptr);
6265 * Broadcaster's HTLC Key
6267 void TxCreationKeys_set_broadcaster_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6270 * Countersignatory's HTLC Key
6272 LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const LDKTxCreationKeys *this_ptr);
6275 * Countersignatory's HTLC Key
6277 void TxCreationKeys_set_countersignatory_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6280 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
6282 LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const LDKTxCreationKeys *this_ptr);
6285 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
6287 void TxCreationKeys_set_broadcaster_delayed_payment_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
6289 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);
6291 LDKCVec_u8Z TxCreationKeys_write(const LDKTxCreationKeys *obj);
6293 LDKTxCreationKeys TxCreationKeys_read(LDKu8slice ser);
6295 void PreCalculatedTxCreationKeys_free(LDKPreCalculatedTxCreationKeys this_ptr);
6298 * Create a new PreCalculatedTxCreationKeys from TxCreationKeys
6300 MUST_USE_RES LDKPreCalculatedTxCreationKeys PreCalculatedTxCreationKeys_new(LDKTxCreationKeys keys);
6303 * The pre-calculated transaction creation public keys.
6304 * An external validating signer should not trust these keys.
6306 MUST_USE_RES LDKTxCreationKeys PreCalculatedTxCreationKeys_trust_key_derivation(const LDKPreCalculatedTxCreationKeys *this_arg);
6309 * The transaction per-commitment point
6311 MUST_USE_RES LDKPublicKey PreCalculatedTxCreationKeys_per_commitment_point(const LDKPreCalculatedTxCreationKeys *this_arg);
6313 void ChannelPublicKeys_free(LDKChannelPublicKeys this_ptr);
6316 * The public key which is used to sign all commitment transactions, as it appears in the
6317 * on-chain channel lock-in 2-of-2 multisig output.
6319 LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const LDKChannelPublicKeys *this_ptr);
6322 * The public key which is used to sign all commitment transactions, as it appears in the
6323 * on-chain channel lock-in 2-of-2 multisig output.
6325 void ChannelPublicKeys_set_funding_pubkey(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6328 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
6329 * revocation keys. This is combined with the per-commitment-secret generated by the
6330 * counterparty to create a secret which the counterparty can reveal to revoke previous
6333 LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const LDKChannelPublicKeys *this_ptr);
6336 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
6337 * revocation keys. This is combined with the per-commitment-secret generated by the
6338 * counterparty to create a secret which the counterparty can reveal to revoke previous
6341 void ChannelPublicKeys_set_revocation_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6344 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
6345 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
6346 * static across every commitment transaction.
6348 LDKPublicKey ChannelPublicKeys_get_payment_point(const LDKChannelPublicKeys *this_ptr);
6351 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
6352 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
6353 * static across every commitment transaction.
6355 void ChannelPublicKeys_set_payment_point(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6358 * The base point which is used (with derive_public_key) to derive a per-commitment payment
6359 * public key which receives non-HTLC-encumbered funds which are only available for spending
6360 * after some delay (or can be claimed via the revocation path).
6362 LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const LDKChannelPublicKeys *this_ptr);
6365 * The base point which is used (with derive_public_key) to derive a per-commitment payment
6366 * public key which receives non-HTLC-encumbered funds which are only available for spending
6367 * after some delay (or can be claimed via the revocation path).
6369 void ChannelPublicKeys_set_delayed_payment_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6372 * The base point which is used (with derive_public_key) to derive a per-commitment public key
6373 * which is used to encumber HTLC-in-flight outputs.
6375 LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const LDKChannelPublicKeys *this_ptr);
6378 * The base point which is used (with derive_public_key) to derive a per-commitment public key
6379 * which is used to encumber HTLC-in-flight outputs.
6381 void ChannelPublicKeys_set_htlc_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6383 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);
6385 LDKCVec_u8Z ChannelPublicKeys_write(const LDKChannelPublicKeys *obj);
6387 LDKChannelPublicKeys ChannelPublicKeys_read(LDKu8slice ser);
6390 * Create a new TxCreationKeys from channel base points and the per-commitment point
6392 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);
6395 * A script either spendable by the revocation
6396 * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
6397 * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
6399 LDKCVec_u8Z get_revokeable_redeemscript(LDKPublicKey revocation_key, uint16_t contest_delay, LDKPublicKey broadcaster_delayed_payment_key);
6401 void HTLCOutputInCommitment_free(LDKHTLCOutputInCommitment this_ptr);
6404 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
6405 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
6406 * need to compare this value to whether the commitment transaction in question is that of
6407 * the counterparty or our own.
6409 bool HTLCOutputInCommitment_get_offered(const LDKHTLCOutputInCommitment *this_ptr);
6412 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
6413 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
6414 * need to compare this value to whether the commitment transaction in question is that of
6415 * the counterparty or our own.
6417 void HTLCOutputInCommitment_set_offered(LDKHTLCOutputInCommitment *this_ptr, bool val);
6420 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
6421 * this divided by 1000.
6423 uint64_t HTLCOutputInCommitment_get_amount_msat(const LDKHTLCOutputInCommitment *this_ptr);
6426 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
6427 * this divided by 1000.
6429 void HTLCOutputInCommitment_set_amount_msat(LDKHTLCOutputInCommitment *this_ptr, uint64_t val);
6432 * The CLTV lock-time at which this HTLC expires.
6434 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const LDKHTLCOutputInCommitment *this_ptr);
6437 * The CLTV lock-time at which this HTLC expires.
6439 void HTLCOutputInCommitment_set_cltv_expiry(LDKHTLCOutputInCommitment *this_ptr, uint32_t val);
6442 * The hash of the preimage which unlocks this HTLC.
6444 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const LDKHTLCOutputInCommitment *this_ptr))[32];
6447 * The hash of the preimage which unlocks this HTLC.
6449 void HTLCOutputInCommitment_set_payment_hash(LDKHTLCOutputInCommitment *this_ptr, LDKThirtyTwoBytes val);
6451 LDKCVec_u8Z HTLCOutputInCommitment_write(const LDKHTLCOutputInCommitment *obj);
6453 LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(LDKu8slice ser);
6456 * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
6457 * does not need to have its previous_output_index filled.
6459 LDKCVec_u8Z get_htlc_redeemscript(const LDKHTLCOutputInCommitment *htlc, const LDKTxCreationKeys *keys);
6462 * Gets the redeemscript for a funding output from the two funding public keys.
6463 * Note that the order of funding public keys does not matter.
6465 LDKCVec_u8Z make_funding_redeemscript(LDKPublicKey broadcaster, LDKPublicKey countersignatory);
6468 * panics if htlc.transaction_output_index.is_none()!
6470 LDKCVec_u8Z 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);
6472 void HolderCommitmentTransaction_free(LDKHolderCommitmentTransaction this_ptr);
6475 * The commitment transaction itself, in unsigned form.
6477 LDKCVec_u8Z HolderCommitmentTransaction_get_unsigned_tx(const LDKHolderCommitmentTransaction *this_ptr);
6480 * The commitment transaction itself, in unsigned form.
6482 void HolderCommitmentTransaction_set_unsigned_tx(LDKHolderCommitmentTransaction *this_ptr, LDKCVec_u8Z val);
6485 * Our counterparty's signature for the transaction, above.
6487 LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const LDKHolderCommitmentTransaction *this_ptr);
6490 * Our counterparty's signature for the transaction, above.
6492 void HolderCommitmentTransaction_set_counterparty_sig(LDKHolderCommitmentTransaction *this_ptr, LDKSignature val);
6495 * The feerate paid per 1000-weight-unit in this commitment transaction. This value is
6496 * controlled by the channel initiator.
6498 uint32_t HolderCommitmentTransaction_get_feerate_per_kw(const LDKHolderCommitmentTransaction *this_ptr);
6501 * The feerate paid per 1000-weight-unit in this commitment transaction. This value is
6502 * controlled by the channel initiator.
6504 void HolderCommitmentTransaction_set_feerate_per_kw(LDKHolderCommitmentTransaction *this_ptr, uint32_t val);
6507 * The HTLCs and counterparty htlc signatures which were included in this commitment transaction.
6509 * Note that this includes all HTLCs, including ones which were considered dust and not
6510 * actually included in the transaction as it appears on-chain, but who's value is burned as
6511 * fees and not included in the to_holder or to_counterparty outputs.
6513 * The counterparty HTLC signatures in the second element will always be set for non-dust HTLCs, ie
6514 * those for which transaction_output_index.is_some().
6516 void HolderCommitmentTransaction_set_per_htlc(LDKHolderCommitmentTransaction *this_ptr, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val);
6519 * Generate a new HolderCommitmentTransaction based on a raw commitment transaction,
6520 * counterparty signature and both parties keys.
6522 * The unsigned transaction outputs must be consistent with htlc_data. This function
6523 * only checks that the shape and amounts are consistent, but does not check the scriptPubkey.
6525 MUST_USE_RES LDKHolderCommitmentTransaction HolderCommitmentTransaction_new_missing_holder_sig(LDKCVec_u8Z 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);
6528 * The pre-calculated transaction creation public keys.
6529 * An external validating signer should not trust these keys.
6531 MUST_USE_RES LDKTxCreationKeys HolderCommitmentTransaction_trust_key_derivation(const LDKHolderCommitmentTransaction *this_arg);
6534 * Get the txid of the holder commitment transaction contained in this
6535 * HolderCommitmentTransaction
6537 MUST_USE_RES LDKThirtyTwoBytes HolderCommitmentTransaction_txid(const LDKHolderCommitmentTransaction *this_arg);
6540 * Gets holder signature for the contained commitment transaction given holder funding private key.
6542 * Funding key is your key included in the 2-2 funding_outpoint lock. Should be provided
6543 * by your ChannelKeys.
6544 * Funding redeemscript is script locking funding_outpoint. This is the mutlsig script
6545 * between your own funding key and your counterparty's. Currently, this is provided in
6546 * ChannelKeys::sign_holder_commitment() calls directly.
6547 * Channel value is amount locked in funding_outpoint.
6549 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);
6552 * Get a signature for each HTLC which was included in the commitment transaction (ie for
6553 * which HTLCOutputInCommitment::transaction_output_index.is_some()).
6555 * The returned Vec has one entry for each HTLC, and in the same order. For HTLCs which were
6556 * considered dust and not included, a None entry exists, for all others a signature is
6559 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);
6561 LDKCVec_u8Z HolderCommitmentTransaction_write(const LDKHolderCommitmentTransaction *obj);
6563 LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(LDKu8slice ser);
6565 void InitFeatures_free(LDKInitFeatures this_ptr);
6567 void NodeFeatures_free(LDKNodeFeatures this_ptr);
6569 void ChannelFeatures_free(LDKChannelFeatures this_ptr);
6571 void RouteHop_free(LDKRouteHop this_ptr);
6574 * The node_id of the node at this hop.
6576 LDKPublicKey RouteHop_get_pubkey(const LDKRouteHop *this_ptr);
6579 * The node_id of the node at this hop.
6581 void RouteHop_set_pubkey(LDKRouteHop *this_ptr, LDKPublicKey val);
6584 * The channel that should be used from the previous hop to reach this node.
6586 uint64_t RouteHop_get_short_channel_id(const LDKRouteHop *this_ptr);
6589 * The channel that should be used from the previous hop to reach this node.
6591 void RouteHop_set_short_channel_id(LDKRouteHop *this_ptr, uint64_t val);
6594 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
6596 uint64_t RouteHop_get_fee_msat(const LDKRouteHop *this_ptr);
6599 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
6601 void RouteHop_set_fee_msat(LDKRouteHop *this_ptr, uint64_t val);
6604 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
6605 * expected at the destination, in excess of the current block height.
6607 uint32_t RouteHop_get_cltv_expiry_delta(const LDKRouteHop *this_ptr);
6610 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
6611 * expected at the destination, in excess of the current block height.
6613 void RouteHop_set_cltv_expiry_delta(LDKRouteHop *this_ptr, uint32_t val);
6615 void Route_free(LDKRoute this_ptr);
6618 * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
6619 * last RouteHop in each path must be the same.
6620 * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
6621 * destination. Thus, this must always be at least length one. While the maximum length of any
6622 * given path is variable, keeping the length of any path to less than 20 should currently
6623 * ensure it is viable.
6625 void Route_set_paths(LDKRoute *this_ptr, LDKCVec_CVec_RouteHopZZ val);
6627 MUST_USE_RES LDKRoute Route_new(LDKCVec_CVec_RouteHopZZ paths_arg);
6629 LDKCVec_u8Z Route_write(const LDKRoute *obj);
6631 LDKRoute Route_read(LDKu8slice ser);
6633 void RouteHint_free(LDKRouteHint this_ptr);
6636 * The node_id of the non-target end of the route
6638 LDKPublicKey RouteHint_get_src_node_id(const LDKRouteHint *this_ptr);
6641 * The node_id of the non-target end of the route
6643 void RouteHint_set_src_node_id(LDKRouteHint *this_ptr, LDKPublicKey val);
6646 * The short_channel_id of this channel
6648 uint64_t RouteHint_get_short_channel_id(const LDKRouteHint *this_ptr);
6651 * The short_channel_id of this channel
6653 void RouteHint_set_short_channel_id(LDKRouteHint *this_ptr, uint64_t val);
6656 * The fees which must be paid to use this channel
6658 LDKRoutingFees RouteHint_get_fees(const LDKRouteHint *this_ptr);
6661 * The fees which must be paid to use this channel
6663 void RouteHint_set_fees(LDKRouteHint *this_ptr, LDKRoutingFees val);
6666 * The difference in CLTV values between this node and the next node.
6668 uint16_t RouteHint_get_cltv_expiry_delta(const LDKRouteHint *this_ptr);
6671 * The difference in CLTV values between this node and the next node.
6673 void RouteHint_set_cltv_expiry_delta(LDKRouteHint *this_ptr, uint16_t val);
6676 * The minimum value, in msat, which must be relayed to the next hop.
6678 uint64_t RouteHint_get_htlc_minimum_msat(const LDKRouteHint *this_ptr);
6681 * The minimum value, in msat, which must be relayed to the next hop.
6683 void RouteHint_set_htlc_minimum_msat(LDKRouteHint *this_ptr, uint64_t val);
6685 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);
6688 * Gets a route from us to the given target node.
6690 * Extra routing hops between known nodes and the target will be used if they are included in
6693 * If some channels aren't announced, it may be useful to fill in a first_hops with the
6694 * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
6695 * view of our local channels (from net_graph_msg_handler) will be ignored, and only those in first_hops
6698 * Panics if first_hops contains channels without short_channel_ids
6699 * (ChannelManager::list_usable_channels will never include such channels).
6701 * The fees on channels from us to next-hops are ignored (as they are assumed to all be
6702 * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat
6703 * *is* checked as they may change based on the receiving node.
6705 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);
6707 void NetworkGraph_free(LDKNetworkGraph this_ptr);
6709 void LockedNetworkGraph_free(LDKLockedNetworkGraph this_ptr);
6711 void NetGraphMsgHandler_free(LDKNetGraphMsgHandler this_ptr);
6714 * Creates a new tracker of the actual state of the network of channels and nodes,
6715 * assuming a fresh network graph.
6716 * Chain monitor is used to make sure announced channels exist on-chain,
6717 * channel data is correct, and that the announcement is signed with
6718 * channel owners' keys.
6720 MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_new(LDKChainWatchInterface chain_monitor, LDKLogger logger);
6723 * Creates a new tracker of the actual state of the network of channels and nodes,
6724 * assuming an existing Network Graph.
6726 MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(LDKChainWatchInterface chain_monitor, LDKLogger logger, LDKNetworkGraph network_graph);
6729 * Take a read lock on the network_graph and return it in the C-bindings
6730 * newtype helper. This is likely only useful when called via the C
6731 * bindings as you can call `self.network_graph.read().unwrap()` in Rust
6734 MUST_USE_RES LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const LDKNetGraphMsgHandler *this_arg);
6737 * Get a reference to the NetworkGraph which this read-lock contains.
6739 MUST_USE_RES LDKNetworkGraph LockedNetworkGraph_graph(const LDKLockedNetworkGraph *this_arg);
6741 LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const LDKNetGraphMsgHandler *this_arg);
6743 void DirectionalChannelInfo_free(LDKDirectionalChannelInfo this_ptr);
6746 * When the last update to the channel direction was issued.
6747 * Value is opaque, as set in the announcement.
6749 uint32_t DirectionalChannelInfo_get_last_update(const LDKDirectionalChannelInfo *this_ptr);
6752 * When the last update to the channel direction was issued.
6753 * Value is opaque, as set in the announcement.
6755 void DirectionalChannelInfo_set_last_update(LDKDirectionalChannelInfo *this_ptr, uint32_t val);
6758 * Whether the channel can be currently used for payments (in this one direction).
6760 bool DirectionalChannelInfo_get_enabled(const LDKDirectionalChannelInfo *this_ptr);
6763 * Whether the channel can be currently used for payments (in this one direction).
6765 void DirectionalChannelInfo_set_enabled(LDKDirectionalChannelInfo *this_ptr, bool val);
6768 * The difference in CLTV values that you must have when routing through this channel.
6770 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const LDKDirectionalChannelInfo *this_ptr);
6773 * The difference in CLTV values that you must have when routing through this channel.
6775 void DirectionalChannelInfo_set_cltv_expiry_delta(LDKDirectionalChannelInfo *this_ptr, uint16_t val);
6778 * The minimum value, which must be relayed to the next hop via the channel
6780 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const LDKDirectionalChannelInfo *this_ptr);
6783 * The minimum value, which must be relayed to the next hop via the channel
6785 void DirectionalChannelInfo_set_htlc_minimum_msat(LDKDirectionalChannelInfo *this_ptr, uint64_t val);
6788 * Most recent update for the channel received from the network
6789 * Mostly redundant with the data we store in fields explicitly.
6790 * Everything else is useful only for sending out for initial routing sync.
6791 * Not stored if contains excess data to prevent DoS.
6793 LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const LDKDirectionalChannelInfo *this_ptr);
6796 * Most recent update for the channel received from the network
6797 * Mostly redundant with the data we store in fields explicitly.
6798 * Everything else is useful only for sending out for initial routing sync.
6799 * Not stored if contains excess data to prevent DoS.
6801 void DirectionalChannelInfo_set_last_update_message(LDKDirectionalChannelInfo *this_ptr, LDKChannelUpdate val);
6803 LDKCVec_u8Z DirectionalChannelInfo_write(const LDKDirectionalChannelInfo *obj);
6805 LDKDirectionalChannelInfo DirectionalChannelInfo_read(LDKu8slice ser);
6807 void ChannelInfo_free(LDKChannelInfo this_ptr);
6810 * Source node of the first direction of a channel
6812 LDKPublicKey ChannelInfo_get_node_one(const LDKChannelInfo *this_ptr);
6815 * Source node of the first direction of a channel
6817 void ChannelInfo_set_node_one(LDKChannelInfo *this_ptr, LDKPublicKey val);
6820 * Details about the first direction of a channel
6822 LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const LDKChannelInfo *this_ptr);
6825 * Details about the first direction of a channel
6827 void ChannelInfo_set_one_to_two(LDKChannelInfo *this_ptr, LDKDirectionalChannelInfo val);
6830 * Source node of the second direction of a channel
6832 LDKPublicKey ChannelInfo_get_node_two(const LDKChannelInfo *this_ptr);
6835 * Source node of the second direction of a channel
6837 void ChannelInfo_set_node_two(LDKChannelInfo *this_ptr, LDKPublicKey val);
6840 * Details about the second direction of a channel
6842 LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const LDKChannelInfo *this_ptr);
6845 * Details about the second direction of a channel
6847 void ChannelInfo_set_two_to_one(LDKChannelInfo *this_ptr, LDKDirectionalChannelInfo val);
6850 * An initial announcement of the channel
6851 * Mostly redundant with the data we store in fields explicitly.
6852 * Everything else is useful only for sending out for initial routing sync.
6853 * Not stored if contains excess data to prevent DoS.
6855 LDKChannelAnnouncement ChannelInfo_get_announcement_message(const LDKChannelInfo *this_ptr);
6858 * An initial announcement of the channel
6859 * Mostly redundant with the data we store in fields explicitly.
6860 * Everything else is useful only for sending out for initial routing sync.
6861 * Not stored if contains excess data to prevent DoS.
6863 void ChannelInfo_set_announcement_message(LDKChannelInfo *this_ptr, LDKChannelAnnouncement val);
6865 LDKCVec_u8Z ChannelInfo_write(const LDKChannelInfo *obj);
6867 LDKChannelInfo ChannelInfo_read(LDKu8slice ser);
6869 void RoutingFees_free(LDKRoutingFees this_ptr);
6872 * Flat routing fee in satoshis
6874 uint32_t RoutingFees_get_base_msat(const LDKRoutingFees *this_ptr);
6877 * Flat routing fee in satoshis
6879 void RoutingFees_set_base_msat(LDKRoutingFees *this_ptr, uint32_t val);
6882 * Liquidity-based routing fee in millionths of a routed amount.
6883 * In other words, 10000 is 1%.
6885 uint32_t RoutingFees_get_proportional_millionths(const LDKRoutingFees *this_ptr);
6888 * Liquidity-based routing fee in millionths of a routed amount.
6889 * In other words, 10000 is 1%.
6891 void RoutingFees_set_proportional_millionths(LDKRoutingFees *this_ptr, uint32_t val);
6893 MUST_USE_RES LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
6895 LDKRoutingFees RoutingFees_read(LDKu8slice ser);
6897 LDKCVec_u8Z RoutingFees_write(const LDKRoutingFees *obj);
6899 void NodeAnnouncementInfo_free(LDKNodeAnnouncementInfo this_ptr);
6902 * When the last known update to the node state was issued.
6903 * Value is opaque, as set in the announcement.
6905 uint32_t NodeAnnouncementInfo_get_last_update(const LDKNodeAnnouncementInfo *this_ptr);
6908 * When the last known update to the node state was issued.
6909 * Value is opaque, as set in the announcement.
6911 void NodeAnnouncementInfo_set_last_update(LDKNodeAnnouncementInfo *this_ptr, uint32_t val);
6914 * Color assigned to the node
6916 const uint8_t (*NodeAnnouncementInfo_get_rgb(const LDKNodeAnnouncementInfo *this_ptr))[3];
6919 * Color assigned to the node
6921 void NodeAnnouncementInfo_set_rgb(LDKNodeAnnouncementInfo *this_ptr, LDKThreeBytes val);
6924 * Moniker assigned to the node.
6925 * May be invalid or malicious (eg control chars),
6926 * should not be exposed to the user.
6928 const uint8_t (*NodeAnnouncementInfo_get_alias(const LDKNodeAnnouncementInfo *this_ptr))[32];
6931 * Moniker assigned to the node.
6932 * May be invalid or malicious (eg control chars),
6933 * should not be exposed to the user.
6935 void NodeAnnouncementInfo_set_alias(LDKNodeAnnouncementInfo *this_ptr, LDKThirtyTwoBytes val);
6938 * Internet-level addresses via which one can connect to the node
6940 void NodeAnnouncementInfo_set_addresses(LDKNodeAnnouncementInfo *this_ptr, LDKCVec_NetAddressZ val);
6943 * An initial announcement of the node
6944 * Mostly redundant with the data we store in fields explicitly.
6945 * Everything else is useful only for sending out for initial routing sync.
6946 * Not stored if contains excess data to prevent DoS.
6948 LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const LDKNodeAnnouncementInfo *this_ptr);
6951 * An initial announcement of the node
6952 * Mostly redundant with the data we store in fields explicitly.
6953 * Everything else is useful only for sending out for initial routing sync.
6954 * Not stored if contains excess data to prevent DoS.
6956 void NodeAnnouncementInfo_set_announcement_message(LDKNodeAnnouncementInfo *this_ptr, LDKNodeAnnouncement val);
6958 LDKCVec_u8Z NodeAnnouncementInfo_write(const LDKNodeAnnouncementInfo *obj);
6960 LDKNodeAnnouncementInfo NodeAnnouncementInfo_read(LDKu8slice ser);
6962 void NodeInfo_free(LDKNodeInfo this_ptr);
6965 * All valid channels a node has announced
6967 void NodeInfo_set_channels(LDKNodeInfo *this_ptr, LDKCVec_u64Z val);
6970 * Lowest fees enabling routing via any of the enabled, known channels to a node.
6971 * The two fields (flat and proportional fee) are independent,
6972 * meaning they don't have to refer to the same channel.
6974 LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const LDKNodeInfo *this_ptr);
6977 * Lowest fees enabling routing via any of the enabled, known channels to a node.
6978 * The two fields (flat and proportional fee) are independent,
6979 * meaning they don't have to refer to the same channel.
6981 void NodeInfo_set_lowest_inbound_channel_fees(LDKNodeInfo *this_ptr, LDKRoutingFees val);
6984 * More information about a node from node_announcement.
6985 * Optional because we store a Node entry after learning about it from
6986 * a channel announcement, but before receiving a node announcement.
6988 LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const LDKNodeInfo *this_ptr);
6991 * More information about a node from node_announcement.
6992 * Optional because we store a Node entry after learning about it from
6993 * a channel announcement, but before receiving a node announcement.
6995 void NodeInfo_set_announcement_info(LDKNodeInfo *this_ptr, LDKNodeAnnouncementInfo val);
6997 MUST_USE_RES LDKNodeInfo NodeInfo_new(LDKCVec_u64Z channels_arg, LDKRoutingFees lowest_inbound_channel_fees_arg, LDKNodeAnnouncementInfo announcement_info_arg);
6999 LDKCVec_u8Z NodeInfo_write(const LDKNodeInfo *obj);
7001 LDKNodeInfo NodeInfo_read(LDKu8slice ser);
7003 LDKCVec_u8Z NetworkGraph_write(const LDKNetworkGraph *obj);
7005 LDKNetworkGraph NetworkGraph_read(LDKu8slice ser);
7008 * Creates a new, empty, network graph.
7010 MUST_USE_RES LDKNetworkGraph NetworkGraph_new(void);
7013 * Close a channel if a corresponding HTLC fail was sent.
7014 * If permanent, removes a channel from the local storage.
7015 * May cause the removal of nodes too, if this was their last channel.
7016 * If not permanent, makes channels unavailable for routing.
7018 void NetworkGraph_close_channel_from_update(LDKNetworkGraph *this_arg, uint64_t short_channel_id, bool is_permanent);
7020 /* Text to put at the end of the generated file */