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 remote party. 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
78 * of this channel). This will force-close the channel in question (which will generate one
79 * final ChannelMonitorUpdate which must be delivered to at least one ChannelMonitor copy).
81 * Should also be used to indicate a failure to update the local persisted copy of the channel
84 LDKChannelMonitorUpdateErr_PermanentFailure,
86 * Must be last for serialization purposes
88 LDKChannelMonitorUpdateErr_Sentinel,
89 } LDKChannelMonitorUpdateErr;
92 * An enum that represents the speed at which we want a transaction to confirm used for feerate
95 typedef enum LDKConfirmationTarget {
97 * We are happy with this transaction confirming slowly when feerate drops some.
99 LDKConfirmationTarget_Background,
101 * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
103 LDKConfirmationTarget_Normal,
105 * We'd like this transaction to confirm in the next few blocks.
107 LDKConfirmationTarget_HighPriority,
109 * Must be last for serialization purposes
111 LDKConfirmationTarget_Sentinel,
112 } LDKConfirmationTarget;
115 * An enum representing the available verbosity levels of the logger.
117 typedef enum LDKLevel {
119 *Designates logger being silent
123 * Designates very serious errors
127 * Designates hazardous situations
131 * Designates useful information
135 * Designates lower priority information
139 * Designates very low priority, often extremely verbose, information
143 * Must be last for serialization purposes
148 typedef enum LDKNetwork {
153 * Must be last for serialization purposes
158 typedef enum LDKSecp256k1Error {
159 LDKSecp256k1Error_IncorrectSignature,
160 LDKSecp256k1Error_InvalidMessage,
161 LDKSecp256k1Error_InvalidPublicKey,
162 LDKSecp256k1Error_InvalidSignature,
163 LDKSecp256k1Error_InvalidSecretKey,
164 LDKSecp256k1Error_InvalidRecoveryId,
165 LDKSecp256k1Error_InvalidTweak,
166 LDKSecp256k1Error_NotEnoughMemory,
167 LDKSecp256k1Error_CallbackPanicked,
169 * Must be last for serialization purposes
171 LDKSecp256k1Error_Sentinel,
174 typedef struct LDKCVecTempl_u8 {
179 typedef LDKCVecTempl_u8 LDKCVec_u8Z;
182 * A transaction output including a scriptPubKey and value.
183 * This type *does* own its own memory, so must be free'd appropriately.
185 typedef struct LDKTxOut {
186 LDKCVec_u8Z script_pubkey;
191 * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
192 * look up the corresponding function in rust-lightning's docs.
194 typedef struct LDKThirtyTwoBytes {
198 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__u32 {
199 LDKThirtyTwoBytes *a;
201 } LDKC2TupleTempl_ThirtyTwoBytes__u32;
203 typedef LDKC2TupleTempl_ThirtyTwoBytes__u32 LDKC2Tuple_Txidu32Z;
205 typedef struct LDKC2TupleTempl_CVec_u8Z__u64 {
208 } LDKC2TupleTempl_CVec_u8Z__u64;
210 typedef LDKC2TupleTempl_CVec_u8Z__u64 LDKC2Tuple_Scriptu64Z;
212 typedef struct LDKC2TupleTempl_u64__u64 {
215 } LDKC2TupleTempl_u64__u64;
217 typedef LDKC2TupleTempl_u64__u64 LDKC2Tuple_u64u64Z;
219 typedef struct LDKSignature {
220 uint8_t compact_form[64];
223 typedef struct LDKCVecTempl_Signature {
226 } LDKCVecTempl_Signature;
228 typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature {
230 LDKCVecTempl_Signature *b;
231 } LDKC2TupleTempl_Signature__CVecTempl_Signature;
233 typedef LDKC2TupleTempl_Signature__CVecTempl_Signature LDKC2Tuple_SignatureCVec_SignatureZZ;
235 typedef LDKCVecTempl_Signature LDKCVec_SignatureZ;
237 typedef union LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 {
238 LDKC2TupleTempl_Signature__CVecTempl_Signature *result;
240 } LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8;
242 typedef struct LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 {
243 LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 contents;
245 } LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8;
247 typedef LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
249 typedef union LDKCResultPtr_Signature__u8 {
250 LDKSignature *result;
252 } LDKCResultPtr_Signature__u8;
254 typedef struct LDKCResultTempl_Signature__u8 {
255 LDKCResultPtr_Signature__u8 contents;
257 } LDKCResultTempl_Signature__u8;
259 typedef LDKCResultTempl_Signature__u8 LDKCResult_SignatureNoneZ;
261 typedef union LDKCResultPtr_CVecTempl_Signature_____u8 {
262 LDKCVecTempl_Signature *result;
264 } LDKCResultPtr_CVecTempl_Signature_____u8;
266 typedef struct LDKCResultTempl_CVecTempl_Signature_____u8 {
267 LDKCResultPtr_CVecTempl_Signature_____u8 contents;
269 } LDKCResultTempl_CVecTempl_Signature_____u8;
271 typedef LDKCResultTempl_CVecTempl_Signature_____u8 LDKCResult_CVec_SignatureZNoneZ;
274 * A Rust str object, ie a reference to a UTF8-valid string.
275 * This is *not* null-terminated so cannot be used directly as a C string!
277 typedef struct LDKStr {
278 const uint8_t *chars;
283 * Indicates an error on the client's part (usually some variant of attempting to use too-low or
286 typedef enum LDKAPIError_Tag {
288 * Indicates the API was wholly misused (see err for more). Cases where these can be returned
289 * are documented, but generally indicates some precondition of a function was violated.
291 LDKAPIError_APIMisuseError,
293 * Due to a high feerate, we were unable to complete the request.
294 * For example, this may be returned if the feerate implies we cannot open a channel at the
295 * requested value, but opening a larger channel would succeed.
297 LDKAPIError_FeeRateTooHigh,
299 * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
300 * too-many-hops, etc).
302 LDKAPIError_RouteError,
304 * We were unable to complete the request as the Channel required to do so is unable to
305 * complete the request (or was not found). This can take many forms, including disconnected
306 * peer, channel at capacity, channel shutting down, etc.
308 LDKAPIError_ChannelUnavailable,
310 * An attempt to call add/update_monitor returned an Err (ie you did this!), causing the
311 * attempted action to fail.
313 LDKAPIError_MonitorUpdateFailed,
315 * Must be last for serialization purposes
317 LDKAPIError_Sentinel,
320 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
322 } LDKAPIError_LDKAPIMisuseError_Body;
324 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
327 } LDKAPIError_LDKFeeRateTooHigh_Body;
329 typedef struct LDKAPIError_LDKRouteError_Body {
331 } LDKAPIError_LDKRouteError_Body;
333 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
335 } LDKAPIError_LDKChannelUnavailable_Body;
337 typedef struct LDKAPIError {
340 LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
341 LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
342 LDKAPIError_LDKRouteError_Body route_error;
343 LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
347 typedef union LDKCResultPtr_u8__APIError {
350 } LDKCResultPtr_u8__APIError;
352 typedef struct LDKCResultTempl_u8__APIError {
353 LDKCResultPtr_u8__APIError contents;
355 } LDKCResultTempl_u8__APIError;
357 typedef LDKCResultTempl_u8__APIError LDKCResult_NoneAPIErrorZ;
362 * If a payment fails to send, it can be in one of several states. This enum is returned as the
363 * Err() type describing which state the payment is in, see the description of individual enum
366 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
368 * Nearly everyhwere, inner must be non-null, however in places where
369 * the Rust equivalent takes an Option, it may be set to null to indicate None.
371 LDKnativePaymentSendFailure *inner;
373 } LDKPaymentSendFailure;
375 typedef union LDKCResultPtr_u8__PaymentSendFailure {
377 LDKPaymentSendFailure *err;
378 } LDKCResultPtr_u8__PaymentSendFailure;
380 typedef struct LDKCResultTempl_u8__PaymentSendFailure {
381 LDKCResultPtr_u8__PaymentSendFailure contents;
383 } LDKCResultTempl_u8__PaymentSendFailure;
385 typedef LDKCResultTempl_u8__PaymentSendFailure LDKCResult_NonePaymentSendFailureZ;
387 typedef union LDKCResultPtr_u8__ChannelMonitorUpdateErr {
389 LDKChannelMonitorUpdateErr *err;
390 } LDKCResultPtr_u8__ChannelMonitorUpdateErr;
392 typedef struct LDKCResultTempl_u8__ChannelMonitorUpdateErr {
393 LDKCResultPtr_u8__ChannelMonitorUpdateErr contents;
395 } LDKCResultTempl_u8__ChannelMonitorUpdateErr;
397 typedef LDKCResultTempl_u8__ChannelMonitorUpdateErr LDKCResult_NoneChannelMonitorUpdateErrZ;
402 * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
403 * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
404 * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
406 * Contains a human-readable error message.
408 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
410 * Nearly everyhwere, inner must be non-null, however in places where
411 * the Rust equivalent takes an Option, it may be set to null to indicate None.
413 LDKnativeMonitorUpdateError *inner;
415 } LDKMonitorUpdateError;
417 typedef union LDKCResultPtr_u8__MonitorUpdateError {
419 LDKMonitorUpdateError *err;
420 } LDKCResultPtr_u8__MonitorUpdateError;
422 typedef struct LDKCResultTempl_u8__MonitorUpdateError {
423 LDKCResultPtr_u8__MonitorUpdateError contents;
425 } LDKCResultTempl_u8__MonitorUpdateError;
427 typedef LDKCResultTempl_u8__MonitorUpdateError LDKCResult_NoneMonitorUpdateErrorZ;
432 * A reference to a transaction output.
434 * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
435 * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
437 typedef struct MUST_USE_STRUCT LDKOutPoint {
439 * Nearly everyhwere, inner must be non-null, however in places where
440 * the Rust equivalent takes an Option, it may be set to null to indicate None.
442 LDKnativeOutPoint *inner;
446 typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z {
449 } LDKC2TupleTempl_OutPoint__CVec_u8Z;
451 typedef LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ;
456 * A channel_announcement message to be sent or received from a peer
458 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
460 * Nearly everyhwere, inner must be non-null, however in places where
461 * the Rust equivalent takes an Option, it may be set to null to indicate None.
463 LDKnativeChannelAnnouncement *inner;
465 } LDKChannelAnnouncement;
470 * A channel_update message to be sent or received from a peer
472 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
474 * Nearly everyhwere, inner must be non-null, however in places where
475 * the Rust equivalent takes an Option, it may be set to null to indicate None.
477 LDKnativeChannelUpdate *inner;
481 typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
482 LDKChannelAnnouncement *a;
485 } LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
487 typedef LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
492 * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
493 * generate no further read_event/write_buffer_space_avail calls for the descriptor, only
494 * triggering a single socket_disconnected call (unless it was provided in response to a
495 * new_*_connection event, in which case no such socket_disconnected() must be called and the
496 * socket silently disconencted).
498 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
500 * Nearly everyhwere, inner must be non-null, however in places where
501 * the Rust equivalent takes an Option, it may be set to null to indicate None.
503 LDKnativePeerHandleError *inner;
505 } LDKPeerHandleError;
507 typedef union LDKCResultPtr_u8__PeerHandleError {
509 LDKPeerHandleError *err;
510 } LDKCResultPtr_u8__PeerHandleError;
512 typedef struct LDKCResultTempl_u8__PeerHandleError {
513 LDKCResultPtr_u8__PeerHandleError contents;
515 } LDKCResultTempl_u8__PeerHandleError;
517 typedef LDKCResultTempl_u8__PeerHandleError LDKCResult_NonePeerHandleErrorZ;
522 * Information about an HTLC as it appears in a commitment transaction
524 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
526 * Nearly everyhwere, inner must be non-null, however in places where
527 * the Rust equivalent takes an Option, it may be set to null to indicate None.
529 LDKnativeHTLCOutputInCommitment *inner;
531 } LDKHTLCOutputInCommitment;
533 typedef struct LDKC2TupleTempl_HTLCOutputInCommitment__Signature {
534 LDKHTLCOutputInCommitment *a;
536 } LDKC2TupleTempl_HTLCOutputInCommitment__Signature;
538 typedef LDKC2TupleTempl_HTLCOutputInCommitment__Signature LDKC2Tuple_HTLCOutputInCommitmentSignatureZ;
540 typedef struct LDKPublicKey {
541 uint8_t compressed_form[33];
545 * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
546 * claim at any point in the future) an event is generated which you must track and be able to
547 * spend on-chain. The information needed to do this is provided in this enum, including the
548 * outpoint describing which txid and output index is available, the full output which exists at
549 * that txid/index, and any keys or other information required to sign.
551 typedef enum LDKSpendableOutputDescriptor_Tag {
553 * An output to a script which was provided via KeysInterface, thus you should already know
554 * how to spend it. No keys are provided as rust-lightning was never given any keys - only the
555 * script_pubkey as it appears in the output.
556 * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
557 * on-chain using the payment preimage or after it has timed out.
559 LDKSpendableOutputDescriptor_StaticOutput,
561 * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
563 * The witness in the spending input should be:
564 * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
566 * Note that the nSequence field in the spending input must be set to to_self_delay
567 * (which means the transaction is not broadcastable until at least to_self_delay
568 * blocks after the outpoint confirms).
570 * These are generally the result of a \"revocable\" output to us, spendable only by us unless
571 * it is an output from an old state which we broadcast (which should never happen).
573 * To derive the delayed_payment key which is used to sign for this input, you must pass the
574 * local delayed_payment_base_key (ie the private key which corresponds to the pubkey in
575 * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
576 * chan_utils::derive_private_key. The public key can be generated without the secret key
577 * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
578 * ChannelKeys::pubkeys().
580 * To derive the remote_revocation_pubkey provided here (which is used in the witness
581 * script generation), you must pass the remote revocation_basepoint (which appears in the
582 * call to ChannelKeys::on_accept) and the provided per_commitment point
583 * to chan_utils::derive_public_revocation_key.
585 * The witness script which is hashed and included in the output script_pubkey may be
586 * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
587 * (derived as above), and the to_self_delay contained here to
588 * chan_utils::get_revokeable_redeemscript.
590 LDKSpendableOutputDescriptor_DynamicOutputP2WSH,
592 * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
593 * corresponds to the public key in ChannelKeys::pubkeys().payment_point).
594 * The witness in the spending input, is, thus, simply:
595 * <BIP 143 signature> <payment key>
597 * These are generally the result of our counterparty having broadcast the current state,
598 * allowing us to claim the non-HTLC-encumbered outputs immediately.
600 LDKSpendableOutputDescriptor_StaticOutputRemotePayment,
602 * Must be last for serialization purposes
604 LDKSpendableOutputDescriptor_Sentinel,
605 } LDKSpendableOutputDescriptor_Tag;
607 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
608 LDKOutPoint outpoint;
610 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
612 typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
613 LDKOutPoint outpoint;
614 LDKPublicKey per_commitment_point;
615 uint16_t to_self_delay;
617 LDKC2Tuple_u64u64Z key_derivation_params;
618 LDKPublicKey remote_revocation_pubkey;
619 } LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
621 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputRemotePayment_Body {
622 LDKOutPoint outpoint;
624 LDKC2Tuple_u64u64Z key_derivation_params;
625 } LDKSpendableOutputDescriptor_LDKStaticOutputRemotePayment_Body;
627 typedef struct LDKSpendableOutputDescriptor {
628 LDKSpendableOutputDescriptor_Tag tag;
630 LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
631 LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh;
632 LDKSpendableOutputDescriptor_LDKStaticOutputRemotePayment_Body static_output_remote_payment;
634 } LDKSpendableOutputDescriptor;
636 typedef struct LDKCVecTempl_SpendableOutputDescriptor {
637 LDKSpendableOutputDescriptor *data;
639 } LDKCVecTempl_SpendableOutputDescriptor;
641 typedef LDKCVecTempl_SpendableOutputDescriptor LDKCVec_SpendableOutputDescriptorZ;
644 * An Event which you should probably take some action in response to.
646 * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
647 * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
648 * written as it makes no sense to respond to it after reconnecting to peers).
650 typedef enum LDKEvent_Tag {
652 * Used to indicate that the client should generate a funding transaction with the given
653 * parameters and then call ChannelManager::funding_transaction_generated.
654 * Generated in ChannelManager message handling.
655 * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
656 * counterparty can steal your funds!
658 LDKEvent_FundingGenerationReady,
660 * Used to indicate that the client may now broadcast the funding transaction it created for a
661 * channel. Broadcasting such a transaction prior to this event may lead to our counterparty
662 * trivially stealing all funds in the funding transaction!
664 LDKEvent_FundingBroadcastSafe,
666 * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
667 * ChannelManager::claim_funds to get it....
668 * Note that if the preimage is not known or the amount paid is incorrect, you should call
669 * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
670 * network congestion.
671 * The amount paid should be considered 'incorrect' when it is less than or more than twice
672 * the amount expected.
673 * If you fail to call either ChannelManager::claim_funds or
674 * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
675 * automatically failed.
677 LDKEvent_PaymentReceived,
679 * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
680 * and we got back the payment preimage for it).
681 * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
682 * deduplicate them by payment_preimage (which MUST be unique)!
684 LDKEvent_PaymentSent,
686 * Indicates an outbound payment we made failed. Probably some intermediary node dropped
687 * something. You may wish to retry with a different route.
688 * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
689 * deduplicate them by payment_hash (which MUST be unique)!
691 LDKEvent_PaymentFailed,
693 * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
694 * time in the future.
696 LDKEvent_PendingHTLCsForwardable,
698 * Used to indicate that an output was generated on-chain which you should know how to spend.
699 * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
700 * counterparty spending them due to some kind of timeout. Thus, you need to store them
701 * somewhere and spend them when you create on-chain transactions.
703 LDKEvent_SpendableOutputs,
705 * Must be last for serialization purposes
710 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
711 LDKThirtyTwoBytes temporary_channel_id;
712 uint64_t channel_value_satoshis;
713 LDKCVec_u8Z output_script;
714 uint64_t user_channel_id;
715 } LDKEvent_LDKFundingGenerationReady_Body;
717 typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
718 LDKOutPoint funding_txo;
719 uint64_t user_channel_id;
720 } LDKEvent_LDKFundingBroadcastSafe_Body;
722 typedef struct LDKEvent_LDKPaymentReceived_Body {
723 LDKThirtyTwoBytes payment_hash;
724 LDKThirtyTwoBytes payment_secret;
726 } LDKEvent_LDKPaymentReceived_Body;
728 typedef struct LDKEvent_LDKPaymentSent_Body {
729 LDKThirtyTwoBytes payment_preimage;
730 } LDKEvent_LDKPaymentSent_Body;
732 typedef struct LDKEvent_LDKPaymentFailed_Body {
733 LDKThirtyTwoBytes payment_hash;
734 bool rejected_by_dest;
735 } LDKEvent_LDKPaymentFailed_Body;
737 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
738 uint64_t time_forwardable;
739 } LDKEvent_LDKPendingHTLCsForwardable_Body;
741 typedef struct LDKEvent_LDKSpendableOutputs_Body {
742 LDKCVec_SpendableOutputDescriptorZ outputs;
743 } LDKEvent_LDKSpendableOutputs_Body;
745 typedef struct LDKEvent {
748 LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
749 LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe;
750 LDKEvent_LDKPaymentReceived_Body payment_received;
751 LDKEvent_LDKPaymentSent_Body payment_sent;
752 LDKEvent_LDKPaymentFailed_Body payment_failed;
753 LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
754 LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
761 * An accept_channel message to be sent or received from a peer
763 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
765 * Nearly everyhwere, inner must be non-null, however in places where
766 * the Rust equivalent takes an Option, it may be set to null to indicate None.
768 LDKnativeAcceptChannel *inner;
775 * An open_channel message to be sent or received from a peer
777 typedef struct MUST_USE_STRUCT LDKOpenChannel {
779 * Nearly everyhwere, inner must be non-null, however in places where
780 * the Rust equivalent takes an Option, it may be set to null to indicate None.
782 LDKnativeOpenChannel *inner;
789 * A funding_created message to be sent or received from a peer
791 typedef struct MUST_USE_STRUCT LDKFundingCreated {
793 * Nearly everyhwere, inner must be non-null, however in places where
794 * the Rust equivalent takes an Option, it may be set to null to indicate None.
796 LDKnativeFundingCreated *inner;
803 * A funding_signed message to be sent or received from a peer
805 typedef struct MUST_USE_STRUCT LDKFundingSigned {
807 * Nearly everyhwere, inner must be non-null, however in places where
808 * the Rust equivalent takes an Option, it may be set to null to indicate None.
810 LDKnativeFundingSigned *inner;
817 * A funding_locked message to be sent or received from a peer
819 typedef struct MUST_USE_STRUCT LDKFundingLocked {
821 * Nearly everyhwere, inner must be non-null, however in places where
822 * the Rust equivalent takes an Option, it may be set to null to indicate None.
824 LDKnativeFundingLocked *inner;
831 * An announcement_signatures message to be sent or received from a peer
833 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
835 * Nearly everyhwere, inner must be non-null, however in places where
836 * the Rust equivalent takes an Option, it may be set to null to indicate None.
838 LDKnativeAnnouncementSignatures *inner;
840 } LDKAnnouncementSignatures;
845 * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
846 * transaction updates if they were pending.
848 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
850 * Nearly everyhwere, inner must be non-null, however in places where
851 * the Rust equivalent takes an Option, it may be set to null to indicate None.
853 LDKnativeCommitmentUpdate *inner;
855 } LDKCommitmentUpdate;
860 * A revoke_and_ack message to be sent or received from a peer
862 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
864 * Nearly everyhwere, inner must be non-null, however in places where
865 * the Rust equivalent takes an Option, it may be set to null to indicate None.
867 LDKnativeRevokeAndACK *inner;
874 * A closing_signed message to be sent or received from a peer
876 typedef struct MUST_USE_STRUCT LDKClosingSigned {
878 * Nearly everyhwere, inner must be non-null, however in places where
879 * the Rust equivalent takes an Option, it may be set to null to indicate None.
881 LDKnativeClosingSigned *inner;
888 * A shutdown message to be sent or received from a peer
890 typedef struct MUST_USE_STRUCT LDKShutdown {
892 * Nearly everyhwere, inner must be non-null, however in places where
893 * the Rust equivalent takes an Option, it may be set to null to indicate None.
895 LDKnativeShutdown *inner;
902 * A channel_reestablish message to be sent or received from a peer
904 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
906 * Nearly everyhwere, inner must be non-null, however in places where
907 * the Rust equivalent takes an Option, it may be set to null to indicate None.
909 LDKnativeChannelReestablish *inner;
911 } LDKChannelReestablish;
916 * A node_announcement message to be sent or received from a peer
918 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
920 * Nearly everyhwere, inner must be non-null, however in places where
921 * the Rust equivalent takes an Option, it may be set to null to indicate None.
923 LDKnativeNodeAnnouncement *inner;
925 } LDKNodeAnnouncement;
930 * An error message to be sent or received from a peer
932 typedef struct MUST_USE_STRUCT LDKErrorMessage {
934 * Nearly everyhwere, inner must be non-null, however in places where
935 * the Rust equivalent takes an Option, it may be set to null to indicate None.
937 LDKnativeErrorMessage *inner;
942 * Used to put an error message in a LightningError
944 typedef enum LDKErrorAction_Tag {
946 * The peer took some action which made us think they were useless. Disconnect them.
948 LDKErrorAction_DisconnectPeer,
950 * The peer did something harmless that we weren't able to process, just log and ignore
952 LDKErrorAction_IgnoreError,
954 * The peer did something incorrect. Tell them.
956 LDKErrorAction_SendErrorMessage,
958 * Must be last for serialization purposes
960 LDKErrorAction_Sentinel,
961 } LDKErrorAction_Tag;
963 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
965 } LDKErrorAction_LDKDisconnectPeer_Body;
967 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
969 } LDKErrorAction_LDKSendErrorMessage_Body;
971 typedef struct LDKErrorAction {
972 LDKErrorAction_Tag tag;
974 LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
975 LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
980 * The information we received from a peer along the route of a payment we originated. This is
981 * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
982 * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
984 typedef enum LDKHTLCFailChannelUpdate_Tag {
986 * We received an error which included a full ChannelUpdate message.
988 LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
990 * We received an error which indicated only that a channel has been closed
992 LDKHTLCFailChannelUpdate_ChannelClosed,
994 * We received an error which indicated only that a node has failed
996 LDKHTLCFailChannelUpdate_NodeFailure,
998 * Must be last for serialization purposes
1000 LDKHTLCFailChannelUpdate_Sentinel,
1001 } LDKHTLCFailChannelUpdate_Tag;
1003 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
1004 LDKChannelUpdate msg;
1005 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
1007 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
1008 uint64_t short_channel_id;
1010 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
1012 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
1013 LDKPublicKey node_id;
1015 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
1017 typedef struct LDKHTLCFailChannelUpdate {
1018 LDKHTLCFailChannelUpdate_Tag tag;
1020 LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
1021 LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
1022 LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
1024 } LDKHTLCFailChannelUpdate;
1027 * An event generated by ChannelManager which indicates a message should be sent to a peer (or
1028 * broadcast to most peers).
1029 * These events are handled by PeerManager::process_events if you are using a PeerManager.
1031 typedef enum LDKMessageSendEvent_Tag {
1033 * Used to indicate that we've accepted a channel open and should send the accept_channel
1034 * message provided to the given peer.
1036 LDKMessageSendEvent_SendAcceptChannel,
1038 * Used to indicate that we've initiated a channel open and should send the open_channel
1039 * message provided to the given peer.
1041 LDKMessageSendEvent_SendOpenChannel,
1043 * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
1045 LDKMessageSendEvent_SendFundingCreated,
1047 * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
1049 LDKMessageSendEvent_SendFundingSigned,
1051 * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
1053 LDKMessageSendEvent_SendFundingLocked,
1055 * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
1057 LDKMessageSendEvent_SendAnnouncementSignatures,
1059 * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
1060 * message should be sent to the peer with the given node_id.
1062 LDKMessageSendEvent_UpdateHTLCs,
1064 * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
1066 LDKMessageSendEvent_SendRevokeAndACK,
1068 * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
1070 LDKMessageSendEvent_SendClosingSigned,
1072 * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
1074 LDKMessageSendEvent_SendShutdown,
1076 * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
1078 LDKMessageSendEvent_SendChannelReestablish,
1080 * Used to indicate that a channel_announcement and channel_update should be broadcast to all
1081 * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
1083 * Note that after doing so, you very likely (unless you did so very recently) want to call
1084 * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
1085 * This ensures that any nodes which see our channel_announcement also have a relevant
1086 * node_announcement, including relevant feature flags which may be important for routing
1089 LDKMessageSendEvent_BroadcastChannelAnnouncement,
1091 * Used to indicate that a node_announcement should be broadcast to all peers.
1093 LDKMessageSendEvent_BroadcastNodeAnnouncement,
1095 * Used to indicate that a channel_update should be broadcast to all peers.
1097 LDKMessageSendEvent_BroadcastChannelUpdate,
1099 * Broadcast an error downstream to be handled
1101 LDKMessageSendEvent_HandleError,
1103 * When a payment fails we may receive updates back from the hop where it failed. In such
1104 * cases this event is generated so that we can inform the network graph of this information.
1106 LDKMessageSendEvent_PaymentFailureNetworkUpdate,
1108 * Must be last for serialization purposes
1110 LDKMessageSendEvent_Sentinel,
1111 } LDKMessageSendEvent_Tag;
1113 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
1114 LDKPublicKey node_id;
1115 LDKAcceptChannel msg;
1116 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
1118 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
1119 LDKPublicKey node_id;
1121 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
1123 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
1124 LDKPublicKey node_id;
1125 LDKFundingCreated msg;
1126 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
1128 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
1129 LDKPublicKey node_id;
1130 LDKFundingSigned msg;
1131 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
1133 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
1134 LDKPublicKey node_id;
1135 LDKFundingLocked msg;
1136 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
1138 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
1139 LDKPublicKey node_id;
1140 LDKAnnouncementSignatures msg;
1141 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
1143 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
1144 LDKPublicKey node_id;
1145 LDKCommitmentUpdate updates;
1146 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
1148 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
1149 LDKPublicKey node_id;
1150 LDKRevokeAndACK msg;
1151 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
1153 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
1154 LDKPublicKey node_id;
1155 LDKClosingSigned msg;
1156 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
1158 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
1159 LDKPublicKey node_id;
1161 } LDKMessageSendEvent_LDKSendShutdown_Body;
1163 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
1164 LDKPublicKey node_id;
1165 LDKChannelReestablish msg;
1166 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
1168 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
1169 LDKChannelAnnouncement msg;
1170 LDKChannelUpdate update_msg;
1171 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
1173 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
1174 LDKNodeAnnouncement msg;
1175 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
1177 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
1178 LDKChannelUpdate msg;
1179 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
1181 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
1182 LDKPublicKey node_id;
1183 LDKErrorAction action;
1184 } LDKMessageSendEvent_LDKHandleError_Body;
1186 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
1187 LDKHTLCFailChannelUpdate update;
1188 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
1190 typedef struct LDKMessageSendEvent {
1191 LDKMessageSendEvent_Tag tag;
1193 LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
1194 LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
1195 LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
1196 LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
1197 LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
1198 LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
1199 LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
1200 LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
1201 LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
1202 LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
1203 LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
1204 LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
1205 LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
1206 LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
1207 LDKMessageSendEvent_LDKHandleError_Body handle_error;
1208 LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
1210 } LDKMessageSendEvent;
1212 typedef struct LDKCVecTempl_MessageSendEvent {
1213 LDKMessageSendEvent *data;
1215 } LDKCVecTempl_MessageSendEvent;
1217 typedef LDKCVecTempl_MessageSendEvent LDKCVec_MessageSendEventZ;
1220 * A trait indicating an object may generate message send events
1222 typedef struct LDKMessageSendEventsProvider {
1225 * Gets the list of pending events which were generated by previous actions, clearing the list
1228 LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
1229 void (*free)(void *this_arg);
1230 } LDKMessageSendEventsProvider;
1232 typedef struct LDKCVecTempl_Event {
1235 } LDKCVecTempl_Event;
1237 typedef LDKCVecTempl_Event LDKCVec_EventZ;
1240 * A trait indicating an object may generate events
1242 typedef struct LDKEventsProvider {
1245 * Gets the list of pending events which were generated by previous actions, clearing the list
1248 LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
1249 void (*free)(void *this_arg);
1250 } LDKEventsProvider;
1253 * A trait encapsulating the operations required of a logger
1255 typedef struct LDKLogger {
1260 void (*log)(const void *this_arg, const char *record);
1261 void (*free)(void *this_arg);
1267 * Configuration we set when applicable.
1269 * Default::default() provides sane defaults.
1271 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
1273 * Nearly everyhwere, inner must be non-null, however in places where
1274 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1276 LDKnativeChannelHandshakeConfig *inner;
1278 } LDKChannelHandshakeConfig;
1283 * Optional channel limits which are applied during channel creation.
1285 * These limits are only applied to our counterparty's limits, not our own.
1287 * Use 0/<type>::max_value() as appropriate to skip checking.
1289 * Provides sane defaults for most configurations.
1291 * Most additional limits are disabled except those with which specify a default in individual
1292 * field documentation. Note that this may result in barely-usable channels, but since they
1293 * are applied mostly only to incoming channels that's not much of a problem.
1295 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
1297 * Nearly everyhwere, inner must be non-null, however in places where
1298 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1300 LDKnativeChannelHandshakeLimits *inner;
1302 } LDKChannelHandshakeLimits;
1307 * Options which apply on a per-channel basis and may change at runtime or based on negotiation
1308 * with our counterparty.
1310 typedef struct MUST_USE_STRUCT LDKChannelConfig {
1312 * Nearly everyhwere, inner must be non-null, however in places where
1313 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1315 LDKnativeChannelConfig *inner;
1319 typedef struct LDKu8slice {
1320 const uint8_t *data;
1327 * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
1329 * Default::default() provides sane defaults for most configurations
1330 * (but currently with 0 relay fees!)
1332 typedef struct MUST_USE_STRUCT LDKUserConfig {
1334 * Nearly everyhwere, inner must be non-null, however in places where
1335 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1337 LDKnativeUserConfig *inner;
1341 typedef union LDKCResultPtr_C2TupleTempl_CVec_u8Z__u64_____ChainError {
1342 LDKC2TupleTempl_CVec_u8Z__u64 *result;
1344 } LDKCResultPtr_C2TupleTempl_CVec_u8Z__u64_____ChainError;
1346 typedef struct LDKCResultTempl_C2TupleTempl_CVec_u8Z__u64_____ChainError {
1347 LDKCResultPtr_C2TupleTempl_CVec_u8Z__u64_____ChainError contents;
1349 } LDKCResultTempl_C2TupleTempl_CVec_u8Z__u64_____ChainError;
1351 typedef LDKCResultTempl_C2TupleTempl_CVec_u8Z__u64_____ChainError LDKCResult_C2Tuple_Scriptu64ZChainErrorZ;
1353 typedef struct LDKCVecTempl_usize {
1356 } LDKCVecTempl_usize;
1358 typedef LDKCVecTempl_usize LDKCVec_usizeZ;
1361 * An interface to request notification of certain scripts as they appear the
1364 * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
1365 * called from inside the library in response to ChainListener events, P2P events, or timer
1368 typedef struct LDKChainWatchInterface {
1371 * Provides a txid/random-scriptPubKey-in-the-tx which much be watched for.
1373 void (*install_watch_tx)(const void *this_arg, const uint8_t (*txid)[32], LDKu8slice script_pub_key);
1375 * Provides an outpoint which must be watched for, providing any transactions which spend the
1378 void (*install_watch_outpoint)(const void *this_arg, LDKC2Tuple_Txidu32Z outpoint, LDKu8slice out_script);
1380 * Indicates that a listener needs to see all transactions.
1382 void (*watch_all_txn)(const void *this_arg);
1384 * Gets the script and value in satoshis for a given unspent transaction output given a
1385 * short_channel_id (aka unspent_tx_output_identier). For BTC/tBTC channels the top three
1386 * bytes are the block height, the next 3 the transaction index within the block, and the
1387 * final two the output within the transaction.
1389 LDKCResult_C2Tuple_Scriptu64ZChainErrorZ (*get_chain_utxo)(const void *this_arg, LDKThirtyTwoBytes genesis_hash, uint64_t unspent_tx_output_identifier);
1391 * Gets the list of transaction indices within a given block that the ChainWatchInterface is
1394 LDKCVec_usizeZ (*filter_block)(const void *this_arg, LDKu8slice block);
1396 * Returns a usize that changes when the ChainWatchInterface's watched data is modified.
1397 * Users of `filter_block` should pre-save a copy of `reentered`'s return value and use it to
1398 * determine whether they need to re-filter a given block.
1400 uintptr_t (*reentered)(const void *this_arg);
1401 void (*free)(void *this_arg);
1402 } LDKChainWatchInterface;
1405 * A reference to a serialized transaction, in (pointer, length) form.
1406 * This type does *not* own its own memory, so access to it after, eg, the call in which it was
1407 * provided to you are invalid.
1409 typedef struct LDKTransaction {
1410 const uint8_t *data;
1415 * An interface to send a transaction to the Bitcoin network.
1417 typedef struct LDKBroadcasterInterface {
1420 * Sends a transaction out to (hopefully) be mined.
1422 void (*broadcast_transaction)(const void *this_arg, LDKTransaction tx);
1423 void (*free)(void *this_arg);
1424 } LDKBroadcasterInterface;
1426 typedef struct LDKCVecTempl_CVec_u8Z {
1429 } LDKCVecTempl_CVec_u8Z;
1431 typedef LDKCVecTempl_CVec_u8Z LDKCVec_TransactionZ;
1433 typedef struct LDKusizeslice {
1434 const uintptr_t *data;
1439 * A trait indicating a desire to listen for events from the chain
1441 typedef struct LDKChainListener {
1444 * Notifies a listener that a block was connected.
1446 * The txn_matched array should be set to references to transactions which matched the
1447 * relevant installed watch outpoints/txn, or the full set of transactions in the block.
1449 * Note that if txn_matched includes only matched transactions, and a new
1450 * transaction/outpoint is watched during a block_connected call, the block *must* be
1451 * re-scanned with the new transaction/outpoints and block_connected should be called
1452 * again with the same header and (at least) the new transactions.
1454 * Note that if non-new transaction/outpoints are be registered during a call, a second call
1455 * *must not* happen.
1457 * This also means those counting confirmations using block_connected callbacks should watch
1458 * for duplicate headers and not count them towards confirmations!
1460 void (*block_connected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height, LDKCVec_TransactionZ txn_matched, LDKusizeslice indexes_of_txn_matched);
1462 * Notifies a listener that a block was disconnected.
1463 * Unlike block_connected, this *must* never be called twice for the same disconnect event.
1464 * Height must be the one of the block which was disconnected (not new height of the best chain)
1466 void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
1467 void (*free)(void *this_arg);
1471 * A trait which should be implemented to provide feerate information on a number of time
1474 * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
1475 * called from inside the library in response to ChainListener events, P2P events, or timer
1478 typedef struct LDKFeeEstimator {
1481 * Gets estimated satoshis of fee required per 1000 Weight-Units.
1483 * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
1484 * don't put us below 1 satoshi-per-byte).
1486 * This translates to:
1487 * * satoshis-per-byte * 250
1488 * * ceil(satoshis-per-kbyte / 4)
1490 uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, LDKConfirmationTarget confirmation_target);
1491 void (*free)(void *this_arg);
1497 * Utility for tracking registered txn/outpoints and checking for matches
1499 typedef struct MUST_USE_STRUCT LDKChainWatchedUtil {
1501 * Nearly everyhwere, inner must be non-null, however in places where
1502 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1504 LDKnativeChainWatchedUtil *inner;
1506 } LDKChainWatchedUtil;
1511 * Utility for notifying listeners about new blocks, and handling block rescans if new watch
1512 * data is registered.
1514 * Rather than using a plain BlockNotifier, it is preferable to use either a BlockNotifierArc
1515 * or a BlockNotifierRef for conciseness. See their documentation for more details, but essentially
1516 * you should default to using a BlockNotifierRef, and use a BlockNotifierArc instead when you
1517 * require ChainListeners with static lifetimes, such as when you're using lightning-net-tokio.
1519 typedef struct MUST_USE_STRUCT LDKBlockNotifier {
1521 * Nearly everyhwere, inner must be non-null, however in places where
1522 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1524 LDKnativeBlockNotifier *inner;
1531 * Utility to capture some common parts of ChainWatchInterface implementors.
1533 * Keeping a local copy of this in a ChainWatchInterface implementor is likely useful.
1535 typedef struct MUST_USE_STRUCT LDKChainWatchInterfaceUtil {
1537 * Nearly everyhwere, inner must be non-null, however in places where
1538 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1540 LDKnativeChainWatchInterfaceUtil *inner;
1542 } LDKChainWatchInterfaceUtil;
1547 * One counterparty's public keys which do not change over the life of a channel.
1549 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
1551 * Nearly everyhwere, inner must be non-null, however in places where
1552 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1554 LDKnativeChannelPublicKeys *inner;
1556 } LDKChannelPublicKeys;
1561 * The per-commitment point and a set of pre-calculated public keys used for transaction creation
1563 * The pre-calculated keys are an optimization, because ChannelKeys has enough
1564 * information to re-derive them.
1566 typedef struct MUST_USE_STRUCT LDKPreCalculatedTxCreationKeys {
1568 * Nearly everyhwere, inner must be non-null, however in places where
1569 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1571 LDKnativePreCalculatedTxCreationKeys *inner;
1573 } LDKPreCalculatedTxCreationKeys;
1575 typedef struct LDKCVecTempl_HTLCOutputInCommitment {
1576 LDKHTLCOutputInCommitment *data;
1578 } LDKCVecTempl_HTLCOutputInCommitment;
1580 typedef LDKCVecTempl_HTLCOutputInCommitment LDKCVec_HTLCOutputInCommitmentZ;
1585 * We use this to track local commitment transactions and put off signing them until we are ready
1586 * to broadcast. This class can be used inside a signer implementation to generate a signature
1587 * given the relevant secret key.
1589 typedef struct MUST_USE_STRUCT LDKLocalCommitmentTransaction {
1591 * Nearly everyhwere, inner must be non-null, however in places where
1592 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1594 LDKnativeLocalCommitmentTransaction *inner;
1596 } LDKLocalCommitmentTransaction;
1601 * The unsigned part of a channel_announcement
1603 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
1605 * Nearly everyhwere, inner must be non-null, however in places where
1606 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1608 LDKnativeUnsignedChannelAnnouncement *inner;
1610 } LDKUnsignedChannelAnnouncement;
1613 * Set of lightning keys needed to operate a channel as described in BOLT 3.
1615 * Signing services could be implemented on a hardware wallet. In this case,
1616 * the current ChannelKeys would be a front-end on top of a communication
1617 * channel connected to your secure device and lightning key material wouldn't
1618 * reside on a hot server. Nevertheless, a this deployment would still need
1619 * to trust the ChannelManager to avoid loss of funds as this latest component
1620 * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
1622 * A more secure iteration would be to use hashlock (or payment points) to pair
1623 * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
1624 * at the price of more state and computation on the hardware wallet side. In the future,
1625 * we are looking forward to design such interface.
1627 * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
1628 * to act, as liveness and breach reply correctness are always going to be hard requirements
1629 * of LN security model, orthogonal of key management issues.
1631 * If you're implementing a custom signer, you almost certainly want to implement
1632 * Readable/Writable to serialize out a unique reference to this set of keys so
1633 * that you can serialize the full ChannelManager object.
1636 typedef struct LDKChannelKeys {
1639 * Gets the per-commitment point for a specific commitment number
1641 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1643 LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
1645 * Gets the commitment secret for a specific commitment number as part of the revocation process
1647 * An external signer implementation should error here if the commitment was already signed
1648 * and should refuse to sign it in the future.
1650 * May be called more than once for the same index.
1652 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
1653 * TODO: return a Result so we can signal a validation error
1655 LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
1657 * Gets the local channel public keys and basepoints
1659 LDKChannelPublicKeys pubkeys;
1661 * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
1662 * Note that this takes a pointer to this object, not the this_ptr like other methods do
1663 * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
1665 void (*set_pubkeys)(const LDKChannelKeys*);
1667 * Gets arbitrary identifiers describing the set of keys which are provided back to you in
1668 * some SpendableOutputDescriptor types. These should be sufficient to identify this
1669 * ChannelKeys object uniquely and lookup or re-derive its keys.
1671 LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
1673 * Create a signature for a remote commitment transaction and associated HTLC transactions.
1675 * Note that if signing fails or is rejected, the channel will be force-closed.
1677 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_remote_commitment)(const void *this_arg, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs);
1679 * Create a signature for a local commitment transaction. This will only ever be called with
1680 * the same local_commitment_tx (or a copy thereof), though there are currently no guarantees
1681 * that it will not be called multiple times.
1682 * An external signer implementation should check that the commitment has not been revoked.
1684 LDKCResult_SignatureNoneZ (*sign_local_commitment)(const void *this_arg, const LDKLocalCommitmentTransaction *local_commitment_tx);
1686 * Create a signature for each HTLC transaction spending a local commitment transaction.
1688 * Unlike sign_local_commitment, this may be called multiple times with *different*
1689 * local_commitment_tx values. While this will never be called with a revoked
1690 * local_commitment_tx, it is possible that it is called with the second-latest
1691 * local_commitment_tx (only if we haven't yet revoked it) if some watchtower/secondary
1692 * ChannelMonitor decided to broadcast before it had been updated to the latest.
1694 * Either an Err should be returned, or a Vec with one entry for each HTLC which exists in
1695 * local_commitment_tx. For those HTLCs which have transaction_output_index set to None
1696 * (implying they were considered dust at the time the commitment transaction was negotiated),
1697 * a corresponding None should be included in the return value. All other positions in the
1698 * return value must contain a signature.
1700 LDKCResult_CVec_SignatureZNoneZ (*sign_local_commitment_htlc_transactions)(const void *this_arg, const LDKLocalCommitmentTransaction *local_commitment_tx);
1702 * Create a signature for the given input in a transaction spending an HTLC or commitment
1703 * transaction output when our counterparty broadcasts an old state.
1705 * A justice transaction may claim multiples outputs at the same time if timelocks are
1706 * similar, but only a signature for the input at index `input` should be signed for here.
1707 * It may be called multiples time for same output(s) if a fee-bump is needed with regards
1708 * to an upcoming timelock expiration.
1710 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1712 * per_commitment_key is revocation secret which was provided by our counterparty when they
1713 * revoked the state which they eventually broadcast. It's not a _local_ secret key and does
1714 * not allow the spending of any funds by itself (you need our local revocation_secret to do
1717 * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
1718 * changing the format of the witness script (which is committed to in the BIP 143
1721 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);
1723 * Create a signature for a claiming transaction for a HTLC output on a remote commitment
1724 * transaction, either offered or received.
1726 * Such a transaction may claim multiples offered outputs at same time if we know the
1727 * preimage for each when we create it, but only the input at index `input` should be
1728 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
1729 * needed with regards to an upcoming timelock expiration.
1731 * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
1734 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
1736 * Per_commitment_point is the dynamic point corresponding to the channel state
1737 * detected onchain. It has been generated by our counterparty and is used to derive
1738 * channel state keys, which are then included in the witness script and committed to in the
1739 * BIP 143 signature.
1741 LDKCResult_SignatureNoneZ (*sign_remote_htlc_transaction)(const void *this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment *htlc);
1743 * Create a signature for a (proposed) closing transaction.
1745 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
1746 * chosen to forgo their output as dust.
1748 LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, LDKTransaction closing_tx);
1750 * Signs a channel announcement message with our funding key, proving it comes from one
1751 * of the channel participants.
1753 * Note that if this fails or is rejected, the channel will not be publicly announced and
1754 * our counterparty may (though likely will not) close the channel on us for violating the
1757 LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const LDKUnsignedChannelAnnouncement *msg);
1759 * Set the remote channel basepoints and remote/local to_self_delay.
1760 * This is done immediately on incoming channels and as soon as the channel is accepted on outgoing channels.
1762 * We bind local_to_self_delay late here for API convenience.
1764 * Will be called before any signatures are applied.
1766 void (*on_accept)(void *this_arg, const LDKChannelPublicKeys *channel_points, uint16_t remote_to_self_delay, uint16_t local_to_self_delay);
1767 void *(*clone)(const void *this_arg);
1768 void (*free)(void *this_arg);
1771 typedef struct LDKSecretKey {
1776 * A trait to describe an object which can get user secrets and key material.
1778 typedef struct LDKKeysInterface {
1781 * Get node secret key (aka node_id or network_key)
1783 LDKSecretKey (*get_node_secret)(const void *this_arg);
1785 * Get destination redeemScript to encumber static protocol exit points.
1787 LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
1789 * Get shutdown_pubkey to use as PublicKey at channel closure
1791 LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
1793 * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
1794 * restarted with some stale data!
1796 LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
1798 * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
1799 * onion packets and for temporary channel IDs. There is no requirement that these be
1800 * persisted anywhere, though they must be unique across restarts.
1802 LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
1803 void (*free)(void *this_arg);
1809 * A simple implementation of ChannelKeys that just keeps the private keys in memory.
1811 typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
1813 * Nearly everyhwere, inner must be non-null, however in places where
1814 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1816 LDKnativeInMemoryChannelKeys *inner;
1818 } LDKInMemoryChannelKeys;
1823 * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
1824 * and derives keys from that.
1826 * Your node_id is seed/0'
1827 * ChannelMonitor closes may use seed/1'
1828 * Cooperative closes may use seed/2'
1829 * The two close keys may be needed to claim on-chain funds!
1831 typedef struct MUST_USE_STRUCT LDKKeysManager {
1833 * Nearly everyhwere, inner must be non-null, however in places where
1834 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1836 LDKnativeKeysManager *inner;
1843 * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
1844 * on-chain transactions to ensure no loss of funds occurs.
1846 * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
1847 * information and are actively monitoring the chain.
1849 * Pending Events or updated HTLCs which have not yet been read out by
1850 * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
1851 * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
1852 * gotten are fully handled before re-serializing the new state.
1854 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
1856 * Nearly everyhwere, inner must be non-null, however in places where
1857 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1859 LDKnativeChannelMonitor *inner;
1861 } LDKChannelMonitor;
1866 * An update generated by the underlying Channel itself which contains some new information the
1867 * ChannelMonitor should be made aware of.
1869 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1871 * Nearly everyhwere, inner must be non-null, however in places where
1872 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1874 LDKnativeChannelMonitorUpdate *inner;
1876 } LDKChannelMonitorUpdate;
1881 * An event to be processed by the ChannelManager.
1883 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1885 * Nearly everyhwere, inner must be non-null, however in places where
1886 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1888 LDKnativeMonitorEvent *inner;
1892 typedef struct LDKCVecTempl_MonitorEvent {
1893 LDKMonitorEvent *data;
1895 } LDKCVecTempl_MonitorEvent;
1897 typedef LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ;
1900 * Simple trait indicating ability to track a set of ChannelMonitors and multiplex events between
1901 * them. Generally should be implemented by keeping a local SimpleManyChannelMonitor and passing
1902 * events to it, while also taking any add/update_monitor events and passing them to some remote
1905 * In general, you must always have at least one local copy in memory, which must never fail to
1906 * update (as it is responsible for broadcasting the latest state in case the channel is closed),
1907 * and then persist it to various on-disk locations. If, for some reason, the in-memory copy fails
1908 * to update (eg out-of-memory or some other condition), you must immediately shut down without
1909 * taking any further action such as writing the current state to disk. This should likely be
1910 * accomplished via panic!() or abort().
1912 * Note that any updates to a channel's monitor *must* be applied to each instance of the
1913 * channel's monitor everywhere (including remote watchtowers) *before* this function returns. If
1914 * an update occurs and a remote watchtower is left with old state, it may broadcast transactions
1915 * which we have revoked, allowing our counterparty to claim all funds in the channel!
1917 * User needs to notify implementors of ManyChannelMonitor when a new block is connected or
1918 * disconnected using their `block_connected` and `block_disconnected` methods. However, rather
1919 * than calling these methods directly, the user should register implementors as listeners to the
1920 * BlockNotifier and call the BlockNotifier's `block_(dis)connected` methods, which will notify
1921 * all registered listeners in one go.
1923 typedef struct LDKManyChannelMonitor {
1926 * Adds a monitor for the given `funding_txo`.
1928 * Implementer must also ensure that the funding_txo txid *and* outpoint are registered with
1929 * any relevant ChainWatchInterfaces such that the provided monitor receives block_connected
1930 * callbacks with the funding transaction, or any spends of it.
1932 * Further, the implementer must also ensure that each output returned in
1933 * monitor.get_outputs_to_watch() is registered to ensure that the provided monitor learns about
1934 * any spends of any of the outputs.
1936 * Any spends of outputs which should have been registered which aren't passed to
1937 * ChannelMonitors via block_connected may result in FUNDS LOSS.
1939 LDKCResult_NoneChannelMonitorUpdateErrZ (*add_monitor)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor);
1941 * Updates a monitor for the given `funding_txo`.
1943 * Implementer must also ensure that the funding_txo txid *and* outpoint are registered with
1944 * any relevant ChainWatchInterfaces such that the provided monitor receives block_connected
1945 * callbacks with the funding transaction, or any spends of it.
1947 * Further, the implementer must also ensure that each output returned in
1948 * monitor.get_watch_outputs() is registered to ensure that the provided monitor learns about
1949 * any spends of any of the outputs.
1951 * Any spends of outputs which should have been registered which aren't passed to
1952 * ChannelMonitors via block_connected may result in FUNDS LOSS.
1954 LDKCResult_NoneChannelMonitorUpdateErrZ (*update_monitor)(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate monitor);
1956 * Used by ChannelManager to get list of HTLC resolved onchain and which needed to be updated
1957 * with success or failure.
1959 * You should probably just call through to
1960 * ChannelMonitor::get_and_clear_pending_monitor_events() for each ChannelMonitor and return
1963 LDKCVec_MonitorEventZ (*get_and_clear_pending_monitor_events)(const void *this_arg);
1964 void (*free)(void *this_arg);
1965 } LDKManyChannelMonitor;
1970 * Manager which keeps track of a number of channels and sends messages to the appropriate
1971 * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
1973 * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
1974 * to individual Channels.
1976 * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
1977 * all peers during write/read (though does not modify this instance, only the instance being
1978 * serialized). This will result in any channels which have not yet exchanged funding_created (ie
1979 * called funding_transaction_generated for outbound channels).
1981 * Note that you can be a bit lazier about writing out ChannelManager than you can be with
1982 * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
1983 * returning from ManyChannelMonitor::add_/update_monitor, with ChannelManagers, writing updates
1984 * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
1985 * the serialization process). If the deserialized version is out-of-date compared to the
1986 * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
1987 * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
1989 * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which
1990 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
1991 * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
1992 * block_connected() to step towards your best block) upon deserialization before using the
1995 * Note that ChannelManager is responsible for tracking liveness of its channels and generating
1996 * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
1997 * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
1998 * offline for a full minute. In order to track this, you must call
1999 * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect.
2001 * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
2002 * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
2003 * essentially you should default to using a SimpleRefChannelManager, and use a
2004 * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
2005 * you're using lightning-net-tokio.
2007 typedef struct MUST_USE_STRUCT LDKChannelManager {
2009 * Nearly everyhwere, inner must be non-null, however in places where
2010 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2012 LDKnativeChannelManager *inner;
2014 } LDKChannelManager;
2019 * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2021 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2023 * Nearly everyhwere, inner must be non-null, however in places where
2024 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2026 LDKnativeChannelDetails *inner;
2028 } LDKChannelDetails;
2033 * Features used within an `init` message.
2035 typedef struct MUST_USE_STRUCT LDKInitFeatures {
2037 * Nearly everyhwere, inner must be non-null, however in places where
2038 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2040 LDKnativeInitFeatures *inner;
2044 typedef struct LDKCVecTempl_ChannelDetails {
2045 LDKChannelDetails *data;
2047 } LDKCVecTempl_ChannelDetails;
2049 typedef LDKCVecTempl_ChannelDetails LDKCVec_ChannelDetailsZ;
2054 * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2055 * it can take multiple paths. Each path is composed of one or more hops through the network.
2057 typedef struct MUST_USE_STRUCT LDKRoute {
2059 * Nearly everyhwere, inner must be non-null, however in places where
2060 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2062 LDKnativeRoute *inner;
2066 typedef struct LDKThreeBytes {
2070 typedef struct LDKFourBytes {
2074 typedef struct LDKSixteenBytes {
2078 typedef struct LDKTenBytes {
2083 * An address which can be used to connect to a remote peer
2085 typedef enum LDKNetAddress_Tag {
2087 * An IPv4 address/port on which the peer is listening.
2091 * An IPv6 address/port on which the peer is listening.
2095 * An old-style Tor onion address/port on which the peer is listening.
2097 LDKNetAddress_OnionV2,
2099 * A new-style Tor onion address/port on which the peer is listening.
2100 * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
2101 * wrap as base32 and append \".onion\".
2103 LDKNetAddress_OnionV3,
2105 * Must be last for serialization purposes
2107 LDKNetAddress_Sentinel,
2108 } LDKNetAddress_Tag;
2110 typedef struct LDKNetAddress_LDKIPv4_Body {
2113 } LDKNetAddress_LDKIPv4_Body;
2115 typedef struct LDKNetAddress_LDKIPv6_Body {
2116 LDKSixteenBytes addr;
2118 } LDKNetAddress_LDKIPv6_Body;
2120 typedef struct LDKNetAddress_LDKOnionV2_Body {
2123 } LDKNetAddress_LDKOnionV2_Body;
2125 typedef struct LDKNetAddress_LDKOnionV3_Body {
2126 LDKThirtyTwoBytes ed25519_pubkey;
2130 } LDKNetAddress_LDKOnionV3_Body;
2132 typedef struct LDKNetAddress {
2133 LDKNetAddress_Tag tag;
2135 LDKNetAddress_LDKIPv4_Body i_pv4;
2136 LDKNetAddress_LDKIPv6_Body i_pv6;
2137 LDKNetAddress_LDKOnionV2_Body onion_v2;
2138 LDKNetAddress_LDKOnionV3_Body onion_v3;
2142 typedef struct LDKCVecTempl_NetAddress {
2143 LDKNetAddress *data;
2145 } LDKCVecTempl_NetAddress;
2147 typedef LDKCVecTempl_NetAddress LDKCVec_NetAddressZ;
2152 * An update_add_htlc message to be sent or received from a peer
2154 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
2156 * Nearly everyhwere, inner must be non-null, however in places where
2157 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2159 LDKnativeUpdateAddHTLC *inner;
2166 * An update_fulfill_htlc message to be sent or received from a peer
2168 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
2170 * Nearly everyhwere, inner must be non-null, however in places where
2171 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2173 LDKnativeUpdateFulfillHTLC *inner;
2175 } LDKUpdateFulfillHTLC;
2180 * An update_fail_htlc message to be sent or received from a peer
2182 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
2184 * Nearly everyhwere, inner must be non-null, however in places where
2185 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2187 LDKnativeUpdateFailHTLC *inner;
2189 } LDKUpdateFailHTLC;
2194 * An update_fail_malformed_htlc message to be sent or received from a peer
2196 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
2198 * Nearly everyhwere, inner must be non-null, however in places where
2199 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2201 LDKnativeUpdateFailMalformedHTLC *inner;
2203 } LDKUpdateFailMalformedHTLC;
2208 * A commitment_signed message to be sent or received from a peer
2210 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
2212 * Nearly everyhwere, inner must be non-null, however in places where
2213 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2215 LDKnativeCommitmentSigned *inner;
2217 } LDKCommitmentSigned;
2222 * An update_fee message to be sent or received from a peer
2224 typedef struct MUST_USE_STRUCT LDKUpdateFee {
2226 * Nearly everyhwere, inner must be non-null, however in places where
2227 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2229 LDKnativeUpdateFee *inner;
2236 * An init message to be sent or received from a peer
2238 typedef struct MUST_USE_STRUCT LDKInit {
2240 * Nearly everyhwere, inner must be non-null, however in places where
2241 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2243 LDKnativeInit *inner;
2248 * A trait to describe an object which can receive channel messages.
2250 * Messages MAY be called in parallel when they originate from different their_node_ids, however
2251 * they MUST NOT be called in parallel when the two calls have the same their_node_id.
2253 typedef struct LDKChannelMessageHandler {
2256 * Handle an incoming open_channel message from the given peer.
2258 void (*handle_open_channel)(const void *this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg);
2260 * Handle an incoming accept_channel message from the given peer.
2262 void (*handle_accept_channel)(const void *this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg);
2264 * Handle an incoming funding_created message from the given peer.
2266 void (*handle_funding_created)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg);
2268 * Handle an incoming funding_signed message from the given peer.
2270 void (*handle_funding_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg);
2272 * Handle an incoming funding_locked message from the given peer.
2274 void (*handle_funding_locked)(const void *this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg);
2276 * Handle an incoming shutdown message from the given peer.
2278 void (*handle_shutdown)(const void *this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg);
2280 * Handle an incoming closing_signed message from the given peer.
2282 void (*handle_closing_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg);
2284 * Handle an incoming update_add_htlc message from the given peer.
2286 void (*handle_update_add_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg);
2288 * Handle an incoming update_fulfill_htlc message from the given peer.
2290 void (*handle_update_fulfill_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg);
2292 * Handle an incoming update_fail_htlc message from the given peer.
2294 void (*handle_update_fail_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg);
2296 * Handle an incoming update_fail_malformed_htlc message from the given peer.
2298 void (*handle_update_fail_malformed_htlc)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg);
2300 * Handle an incoming commitment_signed message from the given peer.
2302 void (*handle_commitment_signed)(const void *this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg);
2304 * Handle an incoming revoke_and_ack message from the given peer.
2306 void (*handle_revoke_and_ack)(const void *this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg);
2308 * Handle an incoming update_fee message from the given peer.
2310 void (*handle_update_fee)(const void *this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg);
2312 * Handle an incoming announcement_signatures message from the given peer.
2314 void (*handle_announcement_signatures)(const void *this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg);
2316 * Indicates a connection to the peer failed/an existing connection was lost. If no connection
2317 * is believed to be possible in the future (eg they're sending us messages we don't
2318 * understand or indicate they require unknown feature bits), no_connection_possible is set
2319 * and any outstanding channels should be failed.
2321 void (*peer_disconnected)(const void *this_arg, LDKPublicKey their_node_id, bool no_connection_possible);
2323 * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
2325 void (*peer_connected)(const void *this_arg, LDKPublicKey their_node_id, const LDKInit *msg);
2327 * Handle an incoming channel_reestablish message from the given peer.
2329 void (*handle_channel_reestablish)(const void *this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg);
2331 * Handle an incoming error message from the given peer.
2333 void (*handle_error)(const void *this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg);
2334 LDKMessageSendEventsProvider MessageSendEventsProvider;
2335 void (*free)(void *this_arg);
2336 } LDKChannelMessageHandler;
2341 * Arguments for the creation of a ChannelManager that are not deserialized.
2343 * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
2345 * 1) Deserialize all stored ChannelMonitors.
2346 * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash,
2347 * ChannelManager)>::read(reader, args).
2348 * This may result in closing some Channels if the ChannelMonitor is newer than the stored
2349 * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
2350 * 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
2351 * ChannelMonitor::get_monitored_outpoints and ChannelMonitor::get_funding_txo().
2352 * 4) Reconnect blocks on your ChannelMonitors.
2353 * 5) Move the ChannelMonitors into your local ManyChannelMonitor.
2354 * 6) Disconnect/connect blocks on the ChannelManager.
2355 * 7) Register the new ChannelManager with your ChainWatchInterface.
2357 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
2359 * Nearly everyhwere, inner must be non-null, however in places where
2360 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2362 LDKnativeChannelManagerReadArgs *inner;
2364 } LDKChannelManagerReadArgs;
2366 typedef struct LDKCVecTempl_ChannelMonitor {
2367 LDKChannelMonitor *data;
2369 } LDKCVecTempl_ChannelMonitor;
2371 typedef LDKCVecTempl_ChannelMonitor LDKCVec_ChannelMonitorZ;
2376 * Simple structure send back by ManyChannelMonitor in case of HTLC detected onchain from a
2377 * forward channel and from which info are needed to update HTLC in a backward channel.
2379 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2381 * Nearly everyhwere, inner must be non-null, however in places where
2382 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2384 LDKnativeHTLCUpdate *inner;
2391 * An error in decoding a message or struct.
2393 typedef struct MUST_USE_STRUCT LDKDecodeError {
2395 * Nearly everyhwere, inner must be non-null, however in places where
2396 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2398 LDKnativeDecodeError *inner;
2405 * A ping message to be sent or received from a peer
2407 typedef struct MUST_USE_STRUCT LDKPing {
2409 * Nearly everyhwere, inner must be non-null, however in places where
2410 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2412 LDKnativePing *inner;
2419 * A pong message to be sent or received from a peer
2421 typedef struct MUST_USE_STRUCT LDKPong {
2423 * Nearly everyhwere, inner must be non-null, however in places where
2424 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2426 LDKnativePong *inner;
2433 * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
2434 * This is used to convince the recipient that the channel is at a certain commitment
2435 * number even if they lost that data due to a local failure. Of course, the peer may lie
2436 * and even later commitments may have been revoked.
2438 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
2440 * Nearly everyhwere, inner must be non-null, however in places where
2441 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2443 LDKnativeDataLossProtect *inner;
2445 } LDKDataLossProtect;
2450 * The unsigned part of a node_announcement
2452 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
2454 * Nearly everyhwere, inner must be non-null, however in places where
2455 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2457 LDKnativeUnsignedNodeAnnouncement *inner;
2459 } LDKUnsignedNodeAnnouncement;
2464 * The unsigned part of a channel_update
2466 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
2468 * Nearly everyhwere, inner must be non-null, however in places where
2469 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2471 LDKnativeUnsignedChannelUpdate *inner;
2473 } LDKUnsignedChannelUpdate;
2478 * An Err type for failure to process messages.
2480 typedef struct MUST_USE_STRUCT LDKLightningError {
2482 * Nearly everyhwere, inner must be non-null, however in places where
2483 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2485 LDKnativeLightningError *inner;
2487 } LDKLightningError;
2489 typedef struct LDKCVecTempl_UpdateAddHTLC {
2490 LDKUpdateAddHTLC *data;
2492 } LDKCVecTempl_UpdateAddHTLC;
2494 typedef LDKCVecTempl_UpdateAddHTLC LDKCVec_UpdateAddHTLCZ;
2496 typedef struct LDKCVecTempl_UpdateFulfillHTLC {
2497 LDKUpdateFulfillHTLC *data;
2499 } LDKCVecTempl_UpdateFulfillHTLC;
2501 typedef LDKCVecTempl_UpdateFulfillHTLC LDKCVec_UpdateFulfillHTLCZ;
2503 typedef struct LDKCVecTempl_UpdateFailHTLC {
2504 LDKUpdateFailHTLC *data;
2506 } LDKCVecTempl_UpdateFailHTLC;
2508 typedef LDKCVecTempl_UpdateFailHTLC LDKCVec_UpdateFailHTLCZ;
2510 typedef struct LDKCVecTempl_UpdateFailMalformedHTLC {
2511 LDKUpdateFailMalformedHTLC *data;
2513 } LDKCVecTempl_UpdateFailMalformedHTLC;
2515 typedef LDKCVecTempl_UpdateFailMalformedHTLC LDKCVec_UpdateFailMalformedHTLCZ;
2517 typedef union LDKCResultPtr_bool__LightningError {
2519 LDKLightningError *err;
2520 } LDKCResultPtr_bool__LightningError;
2522 typedef struct LDKCResultTempl_bool__LightningError {
2523 LDKCResultPtr_bool__LightningError contents;
2525 } LDKCResultTempl_bool__LightningError;
2527 typedef LDKCResultTempl_bool__LightningError LDKCResult_boolLightningErrorZ;
2529 typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
2530 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *data;
2532 } LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
2534 typedef LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
2536 typedef struct LDKCVecTempl_NodeAnnouncement {
2537 LDKNodeAnnouncement *data;
2539 } LDKCVecTempl_NodeAnnouncement;
2541 typedef LDKCVecTempl_NodeAnnouncement LDKCVec_NodeAnnouncementZ;
2544 * A trait to describe an object which can receive routing messages.
2546 typedef struct LDKRoutingMessageHandler {
2549 * Handle an incoming node_announcement message, returning true if it should be forwarded on,
2550 * false or returning an Err otherwise.
2552 LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const LDKNodeAnnouncement *msg);
2554 * Handle a channel_announcement message, returning true if it should be forwarded on, false
2555 * or returning an Err otherwise.
2557 LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const LDKChannelAnnouncement *msg);
2559 * Handle an incoming channel_update message, returning true if it should be forwarded on,
2560 * false or returning an Err otherwise.
2562 LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const LDKChannelUpdate *msg);
2564 * Handle some updates to the route graph that we learned due to an outbound failed payment.
2566 void (*handle_htlc_fail_channel_update)(const void *this_arg, const LDKHTLCFailChannelUpdate *update);
2568 * Gets a subset of the channel announcements and updates required to dump our routing table
2569 * to a remote node, starting at the short_channel_id indicated by starting_point and
2570 * including the batch_amount entries immediately higher in numerical value than starting_point.
2572 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
2574 * Gets a subset of the node announcements required to dump our routing table to a remote node,
2575 * starting at the node *after* the provided publickey and including batch_amount entries
2576 * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
2577 * If None is provided for starting_point, we start at the first node.
2579 LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, LDKPublicKey starting_point, uint8_t batch_amount);
2581 * Returns whether a full sync should be requested from a peer.
2583 bool (*should_request_full_sync)(const void *this_arg, LDKPublicKey node_id);
2584 void (*free)(void *this_arg);
2585 } LDKRoutingMessageHandler;
2590 * Provides references to trait impls which handle different types of messages.
2592 typedef struct MUST_USE_STRUCT LDKMessageHandler {
2594 * Nearly everyhwere, inner must be non-null, however in places where
2595 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2597 LDKnativeMessageHandler *inner;
2599 } LDKMessageHandler;
2602 * Provides an object which can be used to send data to and which uniquely identifies a connection
2603 * to a remote host. You will need to be able to generate multiple of these which meet Eq and
2604 * implement Hash to meet the PeerManager API.
2606 * For efficiency, Clone should be relatively cheap for this type.
2608 * You probably want to just extend an int and put a file descriptor in a struct and implement
2609 * send_data. Note that if you are using a higher-level net library that may call close() itself,
2610 * be careful to ensure you don't have races whereby you might register a new connection with an
2611 * fd which is the same as a previous one which has yet to be removed via
2612 * PeerManager::socket_disconnected().
2614 typedef struct LDKSocketDescriptor {
2617 * Attempts to send some data from the given slice to the peer.
2619 * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
2620 * Note that in the disconnected case, socket_disconnected must still fire and further write
2621 * attempts may occur until that time.
2623 * If the returned size is smaller than data.len(), a write_available event must
2624 * trigger the next time more data can be written. Additionally, until the a send_data event
2625 * completes fully, no further read_events should trigger on the same peer!
2627 * If a read_event on this descriptor had previously returned true (indicating that read
2628 * events should be paused to prevent DoS in the send buffer), resume_read may be set
2629 * indicating that read events on this descriptor should resume. A resume_read of false does
2630 * *not* imply that further read events should be paused.
2632 uintptr_t (*send_data)(void *this_arg, LDKu8slice data, bool resume_read);
2634 * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
2635 * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
2636 * this descriptor. No socket_disconnected call should be generated as a result of this call,
2637 * though races may occur whereby disconnect_socket is called after a call to
2638 * socket_disconnected but prior to socket_disconnected returning.
2640 void (*disconnect_socket)(void *this_arg);
2641 bool (*eq)(const void *this_arg, const void *other_arg);
2642 uint64_t (*hash)(const void *this_arg);
2643 void *(*clone)(const void *this_arg);
2644 void (*free)(void *this_arg);
2645 } LDKSocketDescriptor;
2650 * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
2651 * events into messages which it passes on to its MessageHandlers.
2653 * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
2654 * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
2655 * essentially you should default to using a SimpleRefPeerManager, and use a
2656 * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
2657 * you're using lightning-net-tokio.
2659 typedef struct MUST_USE_STRUCT LDKPeerManager {
2661 * Nearly everyhwere, inner must be non-null, however in places where
2662 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2664 LDKnativePeerManager *inner;
2668 typedef struct LDKCVecTempl_PublicKey {
2671 } LDKCVecTempl_PublicKey;
2673 typedef LDKCVecTempl_PublicKey LDKCVec_PublicKeyZ;
2675 typedef union LDKCResultPtr_CVecTempl_u8_____PeerHandleError {
2676 LDKCVecTempl_u8 *result;
2677 LDKPeerHandleError *err;
2678 } LDKCResultPtr_CVecTempl_u8_____PeerHandleError;
2680 typedef struct LDKCResultTempl_CVecTempl_u8_____PeerHandleError {
2681 LDKCResultPtr_CVecTempl_u8_____PeerHandleError contents;
2683 } LDKCResultTempl_CVecTempl_u8_____PeerHandleError;
2685 typedef LDKCResultTempl_CVecTempl_u8_____PeerHandleError LDKCResult_CVec_u8ZPeerHandleErrorZ;
2687 typedef union LDKCResultPtr_bool__PeerHandleError {
2689 LDKPeerHandleError *err;
2690 } LDKCResultPtr_bool__PeerHandleError;
2692 typedef struct LDKCResultTempl_bool__PeerHandleError {
2693 LDKCResultPtr_bool__PeerHandleError contents;
2695 } LDKCResultTempl_bool__PeerHandleError;
2697 typedef LDKCResultTempl_bool__PeerHandleError LDKCResult_boolPeerHandleErrorZ;
2699 typedef union LDKCResultPtr_SecretKey__Secp256k1Error {
2700 LDKSecretKey *result;
2701 LDKSecp256k1Error *err;
2702 } LDKCResultPtr_SecretKey__Secp256k1Error;
2704 typedef struct LDKCResultTempl_SecretKey__Secp256k1Error {
2705 LDKCResultPtr_SecretKey__Secp256k1Error contents;
2707 } LDKCResultTempl_SecretKey__Secp256k1Error;
2709 typedef LDKCResultTempl_SecretKey__Secp256k1Error LDKCResult_SecretKeySecpErrorZ;
2711 typedef union LDKCResultPtr_PublicKey__Secp256k1Error {
2712 LDKPublicKey *result;
2713 LDKSecp256k1Error *err;
2714 } LDKCResultPtr_PublicKey__Secp256k1Error;
2716 typedef struct LDKCResultTempl_PublicKey__Secp256k1Error {
2717 LDKCResultPtr_PublicKey__Secp256k1Error contents;
2719 } LDKCResultTempl_PublicKey__Secp256k1Error;
2721 typedef LDKCResultTempl_PublicKey__Secp256k1Error LDKCResult_PublicKeySecpErrorZ;
2726 * The set of public keys which are used in the creation of one commitment transaction.
2727 * These are derived from the channel base keys and per-commitment data.
2729 * These keys are assumed to be good, either because the code derived them from
2730 * channel basepoints via the new function, or they were obtained via
2731 * PreCalculatedTxCreationKeys.trust_key_derivation because we trusted the source of the
2732 * pre-calculated keys.
2734 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
2736 * Nearly everyhwere, inner must be non-null, however in places where
2737 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2739 LDKnativeTxCreationKeys *inner;
2741 } LDKTxCreationKeys;
2743 typedef union LDKCResultPtr_TxCreationKeys__Secp256k1Error {
2744 LDKTxCreationKeys *result;
2745 LDKSecp256k1Error *err;
2746 } LDKCResultPtr_TxCreationKeys__Secp256k1Error;
2748 typedef struct LDKCResultTempl_TxCreationKeys__Secp256k1Error {
2749 LDKCResultPtr_TxCreationKeys__Secp256k1Error contents;
2751 } LDKCResultTempl_TxCreationKeys__Secp256k1Error;
2753 typedef LDKCResultTempl_TxCreationKeys__Secp256k1Error LDKCResult_TxCreationKeysSecpErrorZ;
2755 typedef struct LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature {
2756 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *data;
2758 } LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature;
2760 typedef LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ;
2765 * Features used within a `node_announcement` message.
2767 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
2769 * Nearly everyhwere, inner must be non-null, however in places where
2770 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2772 LDKnativeNodeFeatures *inner;
2779 * Features used within a `channel_announcement` message.
2781 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
2783 * Nearly everyhwere, inner must be non-null, however in places where
2784 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2786 LDKnativeChannelFeatures *inner;
2788 } LDKChannelFeatures;
2795 typedef struct MUST_USE_STRUCT LDKRouteHop {
2797 * Nearly everyhwere, inner must be non-null, however in places where
2798 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2800 LDKnativeRouteHop *inner;
2804 typedef struct LDKCVecTempl_RouteHop {
2807 } LDKCVecTempl_RouteHop;
2809 typedef struct LDKCVecTempl_CVecTempl_RouteHop {
2810 LDKCVecTempl_RouteHop *data;
2812 } LDKCVecTempl_CVecTempl_RouteHop;
2814 typedef LDKCVecTempl_CVecTempl_RouteHop LDKCVec_CVec_RouteHopZZ;
2819 * A channel descriptor which provides a last-hop route to get_route
2821 typedef struct MUST_USE_STRUCT LDKRouteHint {
2823 * Nearly everyhwere, inner must be non-null, however in places where
2824 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2826 LDKnativeRouteHint *inner;
2833 * Fees for routing via a given channel or a node
2835 typedef struct MUST_USE_STRUCT LDKRoutingFees {
2837 * Nearly everyhwere, inner must be non-null, however in places where
2838 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2840 LDKnativeRoutingFees *inner;
2844 typedef union LDKCResultPtr_Route__LightningError {
2846 LDKLightningError *err;
2847 } LDKCResultPtr_Route__LightningError;
2849 typedef struct LDKCResultTempl_Route__LightningError {
2850 LDKCResultPtr_Route__LightningError contents;
2852 } LDKCResultTempl_Route__LightningError;
2854 typedef LDKCResultTempl_Route__LightningError LDKCResult_RouteLightningErrorZ;
2859 * Represents the network as nodes and channels between them
2861 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
2863 * Nearly everyhwere, inner must be non-null, however in places where
2864 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2866 LDKnativeNetworkGraph *inner;
2870 typedef struct LDKCVecTempl_RouteHint {
2873 } LDKCVecTempl_RouteHint;
2875 typedef LDKCVecTempl_RouteHint LDKCVec_RouteHintZ;
2880 * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
2881 * This exists only to make accessing a RwLock<NetworkGraph> possible from
2882 * the C bindings, as it can be done directly in Rust code.
2884 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
2886 * Nearly everyhwere, inner must be non-null, however in places where
2887 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2889 LDKnativeLockedNetworkGraph *inner;
2891 } LDKLockedNetworkGraph;
2896 * Receives and validates network updates from peers,
2897 * stores authentic and relevant data as a network graph.
2898 * This network graph is then used for routing payments.
2899 * Provides interface to help with initial routing sync by
2900 * serving historical announcements.
2902 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
2904 * Nearly everyhwere, inner must be non-null, however in places where
2905 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2907 LDKnativeNetGraphMsgHandler *inner;
2909 } LDKNetGraphMsgHandler;
2914 * Details about one direction of a channel. Received
2915 * within a channel update.
2917 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
2919 * Nearly everyhwere, inner must be non-null, however in places where
2920 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2922 LDKnativeDirectionalChannelInfo *inner;
2924 } LDKDirectionalChannelInfo;
2929 * Details about a channel (both directions).
2930 * Received within a channel announcement.
2932 typedef struct MUST_USE_STRUCT LDKChannelInfo {
2934 * Nearly everyhwere, inner must be non-null, however in places where
2935 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2937 LDKnativeChannelInfo *inner;
2944 * Information received in the latest node_announcement from this node.
2946 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
2948 * Nearly everyhwere, inner must be non-null, however in places where
2949 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2951 LDKnativeNodeAnnouncementInfo *inner;
2953 } LDKNodeAnnouncementInfo;
2958 * Details about a node in the network, known from the network announcement.
2960 typedef struct MUST_USE_STRUCT LDKNodeInfo {
2962 * Nearly everyhwere, inner must be non-null, however in places where
2963 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2965 LDKnativeNodeInfo *inner;
2969 typedef struct LDKCVecTempl_u64 {
2974 typedef LDKCVecTempl_u64 LDKCVec_u64Z;
2976 typedef LDKCVecTempl_RouteHop LDKCVec_RouteHopZ;
2978 extern const void (*C2Tuple_HTLCOutputInCommitmentSignatureZ_free)(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ);
2980 extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ);
2982 extern const void (*C2Tuple_Scriptu64Z_free)(LDKC2Tuple_Scriptu64Z);
2984 extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ);
2986 extern const void (*C2Tuple_Txidu32Z_free)(LDKC2Tuple_Txidu32Z);
2988 extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z);
2990 extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ);
2992 extern const LDKCResult_C2Tuple_Scriptu64ZChainErrorZ (*CResult_C2Tuple_Scriptu64ZChainErrorZ_err)(LDKChainError);
2994 extern const void (*CResult_C2Tuple_Scriptu64ZChainErrorZ_free)(LDKCResult_C2Tuple_Scriptu64ZChainErrorZ);
2996 extern const LDKCResult_C2Tuple_Scriptu64ZChainErrorZ (*CResult_C2Tuple_Scriptu64ZChainErrorZ_ok)(LDKC2Tuple_Scriptu64Z);
2998 extern const void (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free)(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ);
3000 extern const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok)(LDKC2Tuple_SignatureCVec_SignatureZZ);
3002 extern const void (*CResult_CVec_SignatureZNoneZ_free)(LDKCResult_CVec_SignatureZNoneZ);
3004 extern const LDKCResult_CVec_SignatureZNoneZ (*CResult_CVec_SignatureZNoneZ_ok)(LDKCVec_SignatureZ);
3006 extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_err)(LDKPeerHandleError);
3008 extern const void (*CResult_CVec_u8ZPeerHandleErrorZ_free)(LDKCResult_CVec_u8ZPeerHandleErrorZ);
3010 extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_ok)(LDKCVec_u8Z);
3012 extern const LDKCResult_NoneAPIErrorZ (*CResult_NoneAPIErrorZ_err)(LDKAPIError);
3014 extern const void (*CResult_NoneAPIErrorZ_free)(LDKCResult_NoneAPIErrorZ);
3016 extern const LDKCResult_NoneChannelMonitorUpdateErrZ (*CResult_NoneChannelMonitorUpdateErrZ_err)(LDKChannelMonitorUpdateErr);
3018 extern const void (*CResult_NoneChannelMonitorUpdateErrZ_free)(LDKCResult_NoneChannelMonitorUpdateErrZ);
3020 extern const LDKCResult_NoneMonitorUpdateErrorZ (*CResult_NoneMonitorUpdateErrorZ_err)(LDKMonitorUpdateError);
3022 extern const void (*CResult_NoneMonitorUpdateErrorZ_free)(LDKCResult_NoneMonitorUpdateErrorZ);
3024 extern const LDKCResult_NonePaymentSendFailureZ (*CResult_NonePaymentSendFailureZ_err)(LDKPaymentSendFailure);
3026 extern const void (*CResult_NonePaymentSendFailureZ_free)(LDKCResult_NonePaymentSendFailureZ);
3028 extern const LDKCResult_NonePeerHandleErrorZ (*CResult_NonePeerHandleErrorZ_err)(LDKPeerHandleError);
3030 extern const void (*CResult_NonePeerHandleErrorZ_free)(LDKCResult_NonePeerHandleErrorZ);
3032 extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_err)(LDKSecp256k1Error);
3034 extern const void (*CResult_PublicKeySecpErrorZ_free)(LDKCResult_PublicKeySecpErrorZ);
3036 extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_ok)(LDKPublicKey);
3038 extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_err)(LDKLightningError);
3040 extern const void (*CResult_RouteLightningErrorZ_free)(LDKCResult_RouteLightningErrorZ);
3042 extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_ok)(LDKRoute);
3044 extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_err)(LDKSecp256k1Error);
3046 extern const void (*CResult_SecretKeySecpErrorZ_free)(LDKCResult_SecretKeySecpErrorZ);
3048 extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_ok)(LDKSecretKey);
3050 extern const void (*CResult_SignatureNoneZ_free)(LDKCResult_SignatureNoneZ);
3052 extern const LDKCResult_SignatureNoneZ (*CResult_SignatureNoneZ_ok)(LDKSignature);
3054 extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_err)(LDKSecp256k1Error);
3056 extern const void (*CResult_TxCreationKeysSecpErrorZ_free)(LDKCResult_TxCreationKeysSecpErrorZ);
3058 extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_ok)(LDKTxCreationKeys);
3060 extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_err)(LDKLightningError);
3062 extern const void (*CResult_boolLightningErrorZ_free)(LDKCResult_boolLightningErrorZ);
3064 extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_ok)(bool);
3066 extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_err)(LDKPeerHandleError);
3068 extern const void (*CResult_boolPeerHandleErrorZ_free)(LDKCResult_boolPeerHandleErrorZ);
3070 extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_ok)(bool);
3072 extern const void (*CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free)(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ);
3074 extern const void (*CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free)(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ);
3076 extern const void (*CVec_CVec_RouteHopZZ_free)(LDKCVec_CVec_RouteHopZZ);
3078 extern const void (*CVec_ChannelDetailsZ_free)(LDKCVec_ChannelDetailsZ);
3080 extern const void (*CVec_ChannelMonitorZ_free)(LDKCVec_ChannelMonitorZ);
3082 extern const void (*CVec_EventZ_free)(LDKCVec_EventZ);
3084 extern const void (*CVec_HTLCOutputInCommitmentZ_free)(LDKCVec_HTLCOutputInCommitmentZ);
3086 extern const void (*CVec_MessageSendEventZ_free)(LDKCVec_MessageSendEventZ);
3088 extern const void (*CVec_MonitorEventZ_free)(LDKCVec_MonitorEventZ);
3090 extern const void (*CVec_NetAddressZ_free)(LDKCVec_NetAddressZ);
3092 extern const void (*CVec_NodeAnnouncementZ_free)(LDKCVec_NodeAnnouncementZ);
3094 extern const void (*CVec_PublicKeyZ_free)(LDKCVec_PublicKeyZ);
3096 extern const void (*CVec_RouteHintZ_free)(LDKCVec_RouteHintZ);
3098 extern const void (*CVec_RouteHopZ_free)(LDKCVec_RouteHopZ);
3100 extern const void (*CVec_SignatureZ_free)(LDKCVec_SignatureZ);
3102 extern const void (*CVec_SpendableOutputDescriptorZ_free)(LDKCVec_SpendableOutputDescriptorZ);
3104 extern const void (*CVec_TransactionZ_free)(LDKCVec_TransactionZ);
3106 extern const void (*CVec_UpdateAddHTLCZ_free)(LDKCVec_UpdateAddHTLCZ);
3108 extern const void (*CVec_UpdateFailHTLCZ_free)(LDKCVec_UpdateFailHTLCZ);
3110 extern const void (*CVec_UpdateFailMalformedHTLCZ_free)(LDKCVec_UpdateFailMalformedHTLCZ);
3112 extern const void (*CVec_UpdateFulfillHTLCZ_free)(LDKCVec_UpdateFulfillHTLCZ);
3114 extern const void (*CVec_u64Z_free)(LDKCVec_u64Z);
3116 extern const void (*CVec_u8Z_free)(LDKCVec_u8Z);
3118 extern const void (*CVec_usizeZ_free)(LDKCVec_usizeZ);
3120 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
3122 void TxOut_free(LDKTxOut _res);
3124 LDKC2Tuple_Txidu32Z C2Tuple_Txidu32Z_new(LDKThirtyTwoBytes a, uint32_t b);
3126 LDKC2Tuple_Scriptu64Z C2Tuple_Scriptu64Z_new(LDKCVec_u8Z a, uint64_t b);
3128 LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
3130 LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(LDKSignature a, LDKCVec_SignatureZ b);
3132 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
3134 LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
3136 LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
3138 LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
3140 LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
3142 LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
3144 LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
3146 LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(LDKOutPoint a, LDKCVec_u8Z b);
3148 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(LDKChannelAnnouncement a, LDKChannelUpdate b, LDKChannelUpdate c);
3150 LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
3152 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ C2Tuple_HTLCOutputInCommitmentSignatureZ_new(LDKHTLCOutputInCommitment a, LDKSignature b);
3154 void Event_free(LDKEvent this_ptr);
3156 void MessageSendEvent_free(LDKMessageSendEvent this_ptr);
3159 * Calls the free function if one is set
3161 void MessageSendEventsProvider_free(LDKMessageSendEventsProvider this_ptr);
3164 * Calls the free function if one is set
3166 void EventsProvider_free(LDKEventsProvider this_ptr);
3168 void APIError_free(LDKAPIError this_ptr);
3171 * Returns the most verbose logging level.
3173 MUST_USE_RES LDKLevel Level_max(void);
3176 * Calls the free function if one is set
3178 void Logger_free(LDKLogger this_ptr);
3180 void ChannelHandshakeConfig_free(LDKChannelHandshakeConfig this_ptr);
3183 * Confirmations we will wait for before considering the channel locked in.
3184 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3185 * equivalent limit applied to outbound channels).
3189 uint32_t ChannelHandshakeConfig_get_minimum_depth(const LDKChannelHandshakeConfig *this_ptr);
3192 * Confirmations we will wait for before considering the channel locked in.
3193 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3194 * equivalent limit applied to outbound channels).
3198 void ChannelHandshakeConfig_set_minimum_depth(LDKChannelHandshakeConfig *this_ptr, uint32_t val);
3201 * Set to the amount of time we require our counterparty to wait to claim their money.
3203 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3204 * be online to check for peer having broadcast a revoked transaction to steal our funds
3205 * at least once every our_to_self_delay blocks.
3207 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3208 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3211 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3212 * opening so you can tweak config to ask for more security, not less.
3214 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const LDKChannelHandshakeConfig *this_ptr);
3217 * Set to the amount of time we require our counterparty to wait to claim their money.
3219 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3220 * be online to check for peer having broadcast a revoked transaction to steal our funds
3221 * at least once every our_to_self_delay blocks.
3223 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3224 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3227 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3228 * opening so you can tweak config to ask for more security, not less.
3230 void ChannelHandshakeConfig_set_our_to_self_delay(LDKChannelHandshakeConfig *this_ptr, uint16_t val);
3233 * Set to the smallest value HTLC we will accept to process.
3235 * This value is sent to our counterparty on channel-open and we close the channel any time
3236 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3238 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3241 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const LDKChannelHandshakeConfig *this_ptr);
3244 * Set to the smallest value HTLC we will accept to process.
3246 * This value is sent to our counterparty on channel-open and we close the channel any time
3247 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3249 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
3252 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(LDKChannelHandshakeConfig *this_ptr, uint64_t val);
3254 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);
3256 MUST_USE_RES LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
3258 void ChannelHandshakeLimits_free(LDKChannelHandshakeLimits this_ptr);
3261 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3262 * only applies to inbound channels.
3266 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3269 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
3270 * only applies to inbound channels.
3274 void ChannelHandshakeLimits_set_min_funding_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3277 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
3278 * you to limit the maximum minimum-size they can require.
3280 * Default value: u64::max_value.
3282 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const LDKChannelHandshakeLimits *this_ptr);
3285 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
3286 * you to limit the maximum minimum-size they can require.
3288 * Default value: u64::max_value.
3290 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3293 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
3294 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
3298 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const LDKChannelHandshakeLimits *this_ptr);
3301 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
3302 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
3306 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3309 * The remote node will require we keep a certain amount in direct payment to ourselves at all
3310 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
3311 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
3313 * Default value: u64::max_value.
3315 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3318 * The remote node will require we keep a certain amount in direct payment to ourselves at all
3319 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
3320 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
3322 * Default value: u64::max_value.
3324 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3327 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
3328 * time. This allows you to set a minimum such value.
3332 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const LDKChannelHandshakeLimits *this_ptr);
3335 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
3336 * time. This allows you to set a minimum such value.
3340 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(LDKChannelHandshakeLimits *this_ptr, uint16_t val);
3343 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
3344 * required to always be higher than this value so this only applies to HTLC outputs (and
3345 * potentially to-self outputs before any payments have been made).
3346 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3347 * This setting allows you to set a minimum dust limit for their commitment transactions,
3348 * reflecting the reality that tiny outputs are not considered standard transactions and will
3349 * not propagate through the Bitcoin network.
3351 * Default value: 546, the current dust limit on the Bitcoin network.
3353 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3356 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
3357 * required to always be higher than this value so this only applies to HTLC outputs (and
3358 * potentially to-self outputs before any payments have been made).
3359 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3360 * This setting allows you to set a minimum dust limit for their commitment transactions,
3361 * reflecting the reality that tiny outputs are not considered standard transactions and will
3362 * not propagate through the Bitcoin network.
3364 * Default value: 546, the current dust limit on the Bitcoin network.
3366 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3369 * Maximum allowed threshold above which outputs will not be generated in their commitment
3371 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3373 * Default value: u64::max_value.
3375 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const LDKChannelHandshakeLimits *this_ptr);
3378 * Maximum allowed threshold above which outputs will not be generated in their commitment
3380 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
3382 * Default value: u64::max_value.
3384 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(LDKChannelHandshakeLimits *this_ptr, uint64_t val);
3387 * Before a channel is usable the funding transaction will need to be confirmed by at least a
3388 * certain number of blocks, specified by the node which is not the funder (as the funder can
3389 * assume they aren't going to double-spend themselves).
3390 * This config allows you to set a limit on the maximum amount of time to wait.
3392 * Default value: 144, or roughly one day and only applies to outbound channels.
3394 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const LDKChannelHandshakeLimits *this_ptr);
3397 * Before a channel is usable the funding transaction will need to be confirmed by at least a
3398 * certain number of blocks, specified by the node which is not the funder (as the funder can
3399 * assume they aren't going to double-spend themselves).
3400 * This config allows you to set a limit on the maximum amount of time to wait.
3402 * Default value: 144, or roughly one day and only applies to outbound channels.
3404 void ChannelHandshakeLimits_set_max_minimum_depth(LDKChannelHandshakeLimits *this_ptr, uint32_t val);
3407 * Set to force the incoming channel to match our announced channel preference in
3410 * Default value: true, to make the default that no announced channels are possible (which is
3411 * appropriate for any nodes which are not online very reliably).
3413 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const LDKChannelHandshakeLimits *this_ptr);
3416 * Set to force the incoming channel to match our announced channel preference in
3419 * Default value: true, to make the default that no announced channels are possible (which is
3420 * appropriate for any nodes which are not online very reliably).
3422 void ChannelHandshakeLimits_set_force_announced_channel_preference(LDKChannelHandshakeLimits *this_ptr, bool val);
3425 * Set to the amount of time we're willing to wait to claim money back to us.
3427 * Not checking this value would be a security issue, as our peer would be able to set it to
3428 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
3430 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
3431 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
3433 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const LDKChannelHandshakeLimits *this_ptr);
3436 * Set to the amount of time we're willing to wait to claim money back to us.
3438 * Not checking this value would be a security issue, as our peer would be able to set it to
3439 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
3441 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
3442 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
3444 void ChannelHandshakeLimits_set_their_to_self_delay(LDKChannelHandshakeLimits *this_ptr, uint16_t val);
3446 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);
3448 MUST_USE_RES LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
3450 void ChannelConfig_free(LDKChannelConfig this_ptr);
3453 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
3454 * This may be allowed to change at runtime in a later update, however doing so must result in
3455 * update messages sent to notify all nodes of our updated relay fee.
3459 uint32_t ChannelConfig_get_fee_proportional_millionths(const LDKChannelConfig *this_ptr);
3462 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
3463 * This may be allowed to change at runtime in a later update, however doing so must result in
3464 * update messages sent to notify all nodes of our updated relay fee.
3468 void ChannelConfig_set_fee_proportional_millionths(LDKChannelConfig *this_ptr, uint32_t val);
3471 * Set to announce the channel publicly and notify all nodes that they can route via this
3474 * This should only be set to true for nodes which expect to be online reliably.
3476 * As the node which funds a channel picks this value this will only apply for new outbound
3477 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
3479 * This cannot be changed after the initial channel handshake.
3481 * Default value: false.
3483 bool ChannelConfig_get_announced_channel(const LDKChannelConfig *this_ptr);
3486 * Set to announce the channel publicly and notify all nodes that they can route via this
3489 * This should only be set to true for nodes which expect to be online reliably.
3491 * As the node which funds a channel picks this value this will only apply for new outbound
3492 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
3494 * This cannot be changed after the initial channel handshake.
3496 * Default value: false.
3498 void ChannelConfig_set_announced_channel(LDKChannelConfig *this_ptr, bool val);
3501 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
3502 * supports it, they will then enforce the mutual-close output to us matches what we provided
3503 * at intialization, preventing us from closing to an alternate pubkey.
3505 * This is set to true by default to provide a slight increase in security, though ultimately
3506 * any attacker who is able to take control of a channel can just as easily send the funds via
3507 * lightning payments, so we never require that our counterparties support this option.
3509 * This cannot be changed after a channel has been initialized.
3511 * Default value: true.
3513 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const LDKChannelConfig *this_ptr);
3516 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
3517 * supports it, they will then enforce the mutual-close output to us matches what we provided
3518 * at intialization, preventing us from closing to an alternate pubkey.
3520 * This is set to true by default to provide a slight increase in security, though ultimately
3521 * any attacker who is able to take control of a channel can just as easily send the funds via
3522 * lightning payments, so we never require that our counterparties support this option.
3524 * This cannot be changed after a channel has been initialized.
3526 * Default value: true.
3528 void ChannelConfig_set_commit_upfront_shutdown_pubkey(LDKChannelConfig *this_ptr, bool val);
3530 MUST_USE_RES LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
3532 MUST_USE_RES LDKChannelConfig ChannelConfig_default(void);
3534 LDKCVec_u8Z ChannelConfig_write(const LDKChannelConfig *obj);
3536 LDKChannelConfig ChannelConfig_read(LDKu8slice ser);
3538 void UserConfig_free(LDKUserConfig this_ptr);
3541 * Channel config that we propose to our counterparty.
3543 LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const LDKUserConfig *this_ptr);
3546 * Channel config that we propose to our counterparty.
3548 void UserConfig_set_own_channel_config(LDKUserConfig *this_ptr, LDKChannelHandshakeConfig val);
3551 * Limits applied to our counterparty's proposed channel config settings.
3553 LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const LDKUserConfig *this_ptr);
3556 * Limits applied to our counterparty's proposed channel config settings.
3558 void UserConfig_set_peer_channel_config_limits(LDKUserConfig *this_ptr, LDKChannelHandshakeLimits val);
3561 * Channel config which affects behavior during channel lifetime.
3563 LDKChannelConfig UserConfig_get_channel_options(const LDKUserConfig *this_ptr);
3566 * Channel config which affects behavior during channel lifetime.
3568 void UserConfig_set_channel_options(LDKUserConfig *this_ptr, LDKChannelConfig val);
3570 MUST_USE_RES LDKUserConfig UserConfig_new(LDKChannelHandshakeConfig own_channel_config_arg, LDKChannelHandshakeLimits peer_channel_config_limits_arg, LDKChannelConfig channel_options_arg);
3572 MUST_USE_RES LDKUserConfig UserConfig_default(void);
3575 * Calls the free function if one is set
3577 void ChainWatchInterface_free(LDKChainWatchInterface this_ptr);
3580 * Calls the free function if one is set
3582 void BroadcasterInterface_free(LDKBroadcasterInterface this_ptr);
3585 * Calls the free function if one is set
3587 void ChainListener_free(LDKChainListener this_ptr);
3590 * Calls the free function if one is set
3592 void FeeEstimator_free(LDKFeeEstimator this_ptr);
3594 void ChainWatchedUtil_free(LDKChainWatchedUtil this_ptr);
3597 * Constructs an empty (watches nothing) ChainWatchedUtil
3599 MUST_USE_RES LDKChainWatchedUtil ChainWatchedUtil_new(void);
3602 * Registers a tx for monitoring, returning true if it was a new tx and false if we'd already
3603 * been watching for it.
3605 MUST_USE_RES bool ChainWatchedUtil_register_tx(LDKChainWatchedUtil *this_arg, const uint8_t (*txid)[32], LDKu8slice script_pub_key);
3608 * Registers an outpoint for monitoring, returning true if it was a new outpoint and false if
3609 * we'd already been watching for it
3611 MUST_USE_RES bool ChainWatchedUtil_register_outpoint(LDKChainWatchedUtil *this_arg, LDKC2Tuple_Txidu32Z outpoint, LDKu8slice _script_pub_key);
3614 * Sets us to match all transactions, returning true if this is a new setting and false if
3615 * we'd already been set to match everything.
3617 MUST_USE_RES bool ChainWatchedUtil_watch_all(LDKChainWatchedUtil *this_arg);
3620 * Checks if a given transaction matches the current filter.
3622 MUST_USE_RES bool ChainWatchedUtil_does_match_tx(const LDKChainWatchedUtil *this_arg, LDKTransaction tx);
3624 void BlockNotifier_free(LDKBlockNotifier this_ptr);
3627 * Constructs a new BlockNotifier without any listeners.
3629 MUST_USE_RES LDKBlockNotifier BlockNotifier_new(LDKChainWatchInterface chain_monitor);
3632 * Register the given listener to receive events.
3634 void BlockNotifier_register_listener(const LDKBlockNotifier *this_arg, LDKChainListener listener);
3637 * Notify listeners that a block was connected given a full, unfiltered block.
3639 * Handles re-scanning the block and calling block_connected again if listeners register new
3640 * watch data during the callbacks for you (see ChainListener::block_connected for more info).
3642 void BlockNotifier_block_connected(const LDKBlockNotifier *this_arg, LDKu8slice block, uint32_t height);
3645 * Notify listeners that a block was connected, given pre-filtered list of transactions in the
3646 * block which matched the filter (probably using does_match_tx).
3648 * Returns true if notified listeners registered additional watch data (implying that the
3649 * block must be re-scanned and this function called again prior to further block_connected
3650 * calls, see ChainListener::block_connected for more info).
3652 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);
3655 * Notify listeners that a block was disconnected.
3657 void BlockNotifier_block_disconnected(const LDKBlockNotifier *this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
3659 void ChainWatchInterfaceUtil_free(LDKChainWatchInterfaceUtil this_ptr);
3661 LDKChainWatchInterface ChainWatchInterfaceUtil_as_ChainWatchInterface(const LDKChainWatchInterfaceUtil *this_arg);
3664 * Creates a new ChainWatchInterfaceUtil for the given network
3666 MUST_USE_RES LDKChainWatchInterfaceUtil ChainWatchInterfaceUtil_new(LDKNetwork network);
3669 * Checks if a given transaction matches the current filter.
3671 MUST_USE_RES bool ChainWatchInterfaceUtil_does_match_tx(const LDKChainWatchInterfaceUtil *this_arg, LDKTransaction tx);
3673 void OutPoint_free(LDKOutPoint this_ptr);
3676 * The referenced transaction's txid.
3678 const uint8_t (*OutPoint_get_txid(const LDKOutPoint *this_ptr))[32];
3681 * The referenced transaction's txid.
3683 void OutPoint_set_txid(LDKOutPoint *this_ptr, LDKThirtyTwoBytes val);
3686 * The index of the referenced output in its transaction's vout.
3688 uint16_t OutPoint_get_index(const LDKOutPoint *this_ptr);
3691 * The index of the referenced output in its transaction's vout.
3693 void OutPoint_set_index(LDKOutPoint *this_ptr, uint16_t val);
3695 MUST_USE_RES LDKOutPoint OutPoint_new(LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
3698 * Convert an `OutPoint` to a lightning channel id.
3700 MUST_USE_RES LDKThirtyTwoBytes OutPoint_to_channel_id(const LDKOutPoint *this_arg);
3702 LDKCVec_u8Z OutPoint_write(const LDKOutPoint *obj);
3704 LDKOutPoint OutPoint_read(LDKu8slice ser);
3706 void SpendableOutputDescriptor_free(LDKSpendableOutputDescriptor this_ptr);
3709 * Calls the free function if one is set
3711 void ChannelKeys_free(LDKChannelKeys this_ptr);
3714 * Calls the free function if one is set
3716 void KeysInterface_free(LDKKeysInterface this_ptr);
3718 void InMemoryChannelKeys_free(LDKInMemoryChannelKeys this_ptr);
3721 * Private key of anchor tx
3723 const uint8_t (*InMemoryChannelKeys_get_funding_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3726 * Private key of anchor tx
3728 void InMemoryChannelKeys_set_funding_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3731 * Local secret key for blinded revocation pubkey
3733 const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3736 * Local secret key for blinded revocation pubkey
3738 void InMemoryChannelKeys_set_revocation_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3741 * Local secret key used for our balance in remote-broadcasted commitment transactions
3743 const uint8_t (*InMemoryChannelKeys_get_payment_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3746 * Local secret key used for our balance in remote-broadcasted commitment transactions
3748 void InMemoryChannelKeys_set_payment_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3751 * Local secret key used in HTLC tx
3753 const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3756 * Local secret key used in HTLC tx
3758 void InMemoryChannelKeys_set_delayed_payment_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3761 * Local htlc secret key used in commitment tx htlc outputs
3763 const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const LDKInMemoryChannelKeys *this_ptr))[32];
3766 * Local htlc secret key used in commitment tx htlc outputs
3768 void InMemoryChannelKeys_set_htlc_base_key(LDKInMemoryChannelKeys *this_ptr, LDKSecretKey val);
3773 const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const LDKInMemoryChannelKeys *this_ptr))[32];
3778 void InMemoryChannelKeys_set_commitment_seed(LDKInMemoryChannelKeys *this_ptr, LDKThirtyTwoBytes val);
3781 * Create a new InMemoryChannelKeys
3783 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);
3787 * Will panic if on_accept wasn't called.
3789 MUST_USE_RES LDKChannelPublicKeys InMemoryChannelKeys_remote_pubkeys(const LDKInMemoryChannelKeys *this_arg);
3792 * The to_self_delay value specified by our counterparty and applied on locally-broadcastable
3793 * transactions, ie the amount of time that we have to wait to recover our funds if we
3794 * broadcast a transaction. You'll likely want to pass this to the
3795 * ln::chan_utils::build*_transaction functions when signing local transactions.
3796 * Will panic if on_accept wasn't called.
3798 MUST_USE_RES uint16_t InMemoryChannelKeys_remote_to_self_delay(const LDKInMemoryChannelKeys *this_arg);
3801 * The to_self_delay value specified by us and applied on transactions broadcastable
3802 * by our counterparty, ie the amount of time that they have to wait to recover their funds
3803 * if they broadcast a transaction.
3804 * Will panic if on_accept wasn't called.
3806 MUST_USE_RES uint16_t InMemoryChannelKeys_local_to_self_delay(const LDKInMemoryChannelKeys *this_arg);
3808 LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const LDKInMemoryChannelKeys *this_arg);
3810 LDKCVec_u8Z InMemoryChannelKeys_write(const LDKInMemoryChannelKeys *obj);
3812 LDKInMemoryChannelKeys InMemoryChannelKeys_read(LDKu8slice ser);
3814 void KeysManager_free(LDKKeysManager this_ptr);
3817 * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
3818 * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
3819 * starting_time isn't strictly required to actually be a time, but it must absolutely,
3820 * without a doubt, be unique to this instance. ie if you start multiple times with the same
3821 * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
3822 * simply use the current time (with very high precision).
3824 * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
3825 * obviously, starting_time should be unique every time you reload the library - it is only
3826 * used to generate new ephemeral key data (which will be stored by the individual channel if
3829 * Note that the seed is required to recover certain on-chain funds independent of
3830 * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
3831 * channel, and some on-chain during-closing funds.
3833 * Note that until the 0.1 release there is no guarantee of backward compatibility between
3834 * versions. Once the library is more fully supported, the docs will be updated to include a
3835 * detailed description of the guarantee.
3837 MUST_USE_RES LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos);
3840 * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation
3842 * Key derivation parameters are accessible through a per-channel secrets
3843 * ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of
3844 * onchain output detection for which a corresponding delayed_payment_key must be derived.
3846 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);
3848 LDKKeysInterface KeysManager_as_KeysInterface(const LDKKeysManager *this_arg);
3850 void ChannelManager_free(LDKChannelManager this_ptr);
3852 void ChannelDetails_free(LDKChannelDetails this_ptr);
3855 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
3856 * thereafter this is the txid of the funding transaction xor the funding transaction output).
3857 * Note that this means this value is *not* persistent - it can change once during the
3858 * lifetime of the channel.
3860 const uint8_t (*ChannelDetails_get_channel_id(const LDKChannelDetails *this_ptr))[32];
3863 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
3864 * thereafter this is the txid of the funding transaction xor the funding transaction output).
3865 * Note that this means this value is *not* persistent - it can change once during the
3866 * lifetime of the channel.
3868 void ChannelDetails_set_channel_id(LDKChannelDetails *this_ptr, LDKThirtyTwoBytes val);
3871 * The node_id of our counterparty
3873 LDKPublicKey ChannelDetails_get_remote_network_id(const LDKChannelDetails *this_ptr);
3876 * The node_id of our counterparty
3878 void ChannelDetails_set_remote_network_id(LDKChannelDetails *this_ptr, LDKPublicKey val);
3881 * The Features the channel counterparty provided upon last connection.
3882 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
3883 * many routing-relevant features are present in the init context.
3885 LDKInitFeatures ChannelDetails_get_counterparty_features(const LDKChannelDetails *this_ptr);
3888 * The Features the channel counterparty provided upon last connection.
3889 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
3890 * many routing-relevant features are present in the init context.
3892 void ChannelDetails_set_counterparty_features(LDKChannelDetails *this_ptr, LDKInitFeatures val);
3895 * The value, in satoshis, of this channel as appears in the funding output
3897 uint64_t ChannelDetails_get_channel_value_satoshis(const LDKChannelDetails *this_ptr);
3900 * The value, in satoshis, of this channel as appears in the funding output
3902 void ChannelDetails_set_channel_value_satoshis(LDKChannelDetails *this_ptr, uint64_t val);
3905 * The user_id passed in to create_channel, or 0 if the channel was inbound.
3907 uint64_t ChannelDetails_get_user_id(const LDKChannelDetails *this_ptr);
3910 * The user_id passed in to create_channel, or 0 if the channel was inbound.
3912 void ChannelDetails_set_user_id(LDKChannelDetails *this_ptr, uint64_t val);
3915 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
3916 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
3917 * available for inclusion in new outbound HTLCs). This further does not include any pending
3918 * outgoing HTLCs which are awaiting some other resolution to be sent.
3920 uint64_t ChannelDetails_get_outbound_capacity_msat(const LDKChannelDetails *this_ptr);
3923 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
3924 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
3925 * available for inclusion in new outbound HTLCs). This further does not include any pending
3926 * outgoing HTLCs which are awaiting some other resolution to be sent.
3928 void ChannelDetails_set_outbound_capacity_msat(LDKChannelDetails *this_ptr, uint64_t val);
3931 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
3932 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
3933 * available for inclusion in new inbound HTLCs).
3934 * Note that there are some corner cases not fully handled here, so the actual available
3935 * inbound capacity may be slightly higher than this.
3937 uint64_t ChannelDetails_get_inbound_capacity_msat(const LDKChannelDetails *this_ptr);
3940 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
3941 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
3942 * available for inclusion in new inbound HTLCs).
3943 * Note that there are some corner cases not fully handled here, so the actual available
3944 * inbound capacity may be slightly higher than this.
3946 void ChannelDetails_set_inbound_capacity_msat(LDKChannelDetails *this_ptr, uint64_t val);
3949 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
3950 * the peer is connected, and (c) no monitor update failure is pending resolution.
3952 bool ChannelDetails_get_is_live(const LDKChannelDetails *this_ptr);
3955 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
3956 * the peer is connected, and (c) no monitor update failure is pending resolution.
3958 void ChannelDetails_set_is_live(LDKChannelDetails *this_ptr, bool val);
3960 void PaymentSendFailure_free(LDKPaymentSendFailure this_ptr);
3963 * Constructs a new ChannelManager to hold several channels and route between them.
3965 * This is the main \"logic hub\" for all channel-related actions, and implements
3966 * ChannelMessageHandler.
3968 * Non-proportional fees are fixed according to our risk using the provided fee estimator.
3970 * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
3972 * Users must provide the current blockchain height from which to track onchain channel
3973 * funding outpoints and send payments with reliable timelocks.
3975 * Users need to notify the new ChannelManager when a new block is connected or
3976 * disconnected using its `block_connected` and `block_disconnected` methods.
3977 * However, rather than calling these methods directly, the user should register
3978 * the ChannelManager as a listener to the BlockNotifier and call the BlockNotifier's
3979 * `block_(dis)connected` methods, which will notify all registered listeners in one
3982 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);
3985 * Creates a new outbound channel to the given remote node and with the given value.
3987 * user_id will be provided back as user_channel_id in FundingGenerationReady and
3988 * FundingBroadcastSafe events to allow tracking of which events correspond with which
3989 * create_channel call. Note that user_channel_id defaults to 0 for inbound channels, so you
3990 * may wish to avoid using 0 for user_id here.
3992 * If successful, will generate a SendOpenChannel message event, so you should probably poll
3993 * PeerManager::process_events afterwards.
3995 * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
3996 * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
3998 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);
4001 * Gets the list of open channels, in random order. See ChannelDetail field documentation for
4004 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const LDKChannelManager *this_arg);
4007 * Gets the list of usable channels, in random order. Useful as an argument to
4008 * get_route to ensure non-announced channels are used.
4010 * These are guaranteed to have their is_live value set to true, see the documentation for
4011 * ChannelDetails::is_live for more info on exactly what the criteria are.
4013 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const LDKChannelManager *this_arg);
4016 * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
4017 * will be accepted on the given channel, and after additional timeout/the closing of all
4018 * pending HTLCs, the channel will be closed on chain.
4020 * May generate a SendShutdown message event on success, which should be relayed.
4022 MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const LDKChannelManager *this_arg, const uint8_t (*channel_id)[32]);
4025 * Force closes a channel, immediately broadcasting the latest local commitment transaction to
4026 * the chain and rejecting new HTLCs on the given channel.
4028 void ChannelManager_force_close_channel(const LDKChannelManager *this_arg, const uint8_t (*channel_id)[32]);
4031 * Force close all channels, immediately broadcasting the latest local commitment transaction
4032 * for each to the chain and rejecting new HTLCs on each.
4034 void ChannelManager_force_close_all_channels(const LDKChannelManager *this_arg);
4037 * Sends a payment along a given route.
4039 * Value parameters are provided via the last hop in route, see documentation for RouteHop
4040 * fields for more info.
4042 * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
4043 * payment), we don't do anything to stop you! We always try to ensure that if the provided
4044 * next hop knows the preimage to payment_hash they can claim an additional amount as
4045 * specified in the last hop in the route! Thus, you should probably do your own
4046 * payment_preimage tracking (which you should already be doing as they represent \"proof of
4047 * payment\") and prevent double-sends yourself.
4049 * May generate SendHTLCs message(s) event on success, which should be relayed.
4051 * Each path may have a different return value, and PaymentSendValue may return a Vec with
4052 * each entry matching the corresponding-index entry in the route paths, see
4053 * PaymentSendFailure for more info.
4055 * In general, a path may raise:
4056 * * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
4057 * node public key) is specified.
4058 * * APIError::ChannelUnavailable if the next-hop channel is not available for updates
4059 * (including due to previous monitor update failure or new permanent monitor update
4061 * * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
4064 * Note that depending on the type of the PaymentSendFailure the HTLC may have been
4065 * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
4066 * different route unless you intend to pay twice!
4068 * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
4069 * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
4070 * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
4071 * must not contain multiple paths as multi-path payments require a recipient-provided
4073 * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
4074 * bit set (either as required or as available). If multiple paths are present in the Route,
4075 * we assume the invoice had the basic_mpp feature set.
4077 MUST_USE_RES LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const LDKChannelManager *this_arg, const LDKRoute *route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret);
4080 * Call this upon creation of a funding transaction for the given channel.
4082 * Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
4083 * or your counterparty can steal your funds!
4085 * Panics if a funding transaction has already been provided for this channel.
4087 * May panic if the funding_txo is duplicative with some other channel (note that this should
4088 * be trivially prevented by using unique funding transaction keys per-channel).
4090 void ChannelManager_funding_transaction_generated(const LDKChannelManager *this_arg, const uint8_t (*temporary_channel_id)[32], LDKOutPoint funding_txo);
4093 * Generates a signed node_announcement from the given arguments and creates a
4094 * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
4095 * seen a channel_announcement from us (ie unless we have public channels open).
4097 * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
4098 * to humans. They carry no in-protocol meaning.
4100 * addresses represent the set (possibly empty) of socket addresses on which this node accepts
4101 * incoming connections. These will be broadcast to the network, publicly tying these
4102 * addresses together. If you wish to preserve user privacy, addresses should likely contain
4103 * only Tor Onion addresses.
4105 * Panics if addresses is absurdly large (more than 500).
4107 void ChannelManager_broadcast_node_announcement(const LDKChannelManager *this_arg, LDKThreeBytes rgb, LDKThirtyTwoBytes alias, LDKCVec_NetAddressZ addresses);
4110 * Processes HTLCs which are pending waiting on random forward delay.
4112 * Should only really ever be called in response to a PendingHTLCsForwardable event.
4113 * Will likely generate further events.
4115 void ChannelManager_process_pending_htlc_forwards(const LDKChannelManager *this_arg);
4118 * If a peer is disconnected we mark any channels with that peer as 'disabled'.
4119 * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
4120 * to inform the network about the uselessness of these channels.
4122 * This method handles all the details, and must be called roughly once per minute.
4124 void ChannelManager_timer_chan_freshness_every_min(const LDKChannelManager *this_arg);
4127 * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
4128 * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
4129 * along the path (including in our own channel on which we received it).
4130 * Returns false if no payment was found to fail backwards, true if the process of failing the
4131 * HTLC backwards has been started.
4133 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const LDKChannelManager *this_arg, const uint8_t (*payment_hash)[32], LDKThirtyTwoBytes payment_secret);
4136 * Provides a payment preimage in response to a PaymentReceived event, returning true and
4137 * generating message events for the net layer to claim the payment, if possible. Thus, you
4138 * should probably kick the net layer to go send messages if this returns true!
4140 * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
4141 * available within a few percent of the expected amount. This is critical for several
4142 * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
4143 * payment_preimage without having provided the full value and b) it avoids certain
4144 * privacy-breaking recipient-probing attacks which may reveal payment activity to
4145 * motivated attackers.
4147 * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
4148 * set. Thus, for such payments we will claim any payments which do not under-pay.
4150 * May panic if called except in response to a PaymentReceived event.
4152 MUST_USE_RES bool ChannelManager_claim_funds(const LDKChannelManager *this_arg, LDKThirtyTwoBytes payment_preimage, LDKThirtyTwoBytes payment_secret, uint64_t expected_amount);
4155 * Gets the node_id held by this ChannelManager
4157 MUST_USE_RES LDKPublicKey ChannelManager_get_our_node_id(const LDKChannelManager *this_arg);
4160 * Restores a single, given channel to normal operation after a
4161 * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
4164 * All ChannelMonitor updates up to and including highest_applied_update_id must have been
4165 * fully committed in every copy of the given channels' ChannelMonitors.
4167 * Note that there is no effect to calling with a highest_applied_update_id other than the
4168 * current latest ChannelMonitorUpdate and one call to this function after multiple
4169 * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
4170 * exists largely only to prevent races between this and concurrent update_monitor calls.
4172 * Thus, the anticipated use is, at a high level:
4173 * 1) You register a ManyChannelMonitor with this ChannelManager,
4174 * 2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
4175 * said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
4176 * any time it cannot do so instantly,
4177 * 3) update(s) are applied to each remote copy of a ChannelMonitor,
4178 * 4) once all remote copies are updated, you call this function with the update_id that
4179 * completed, and once it is the latest the Channel will be re-enabled.
4181 void ChannelManager_channel_monitor_updated(const LDKChannelManager *this_arg, const LDKOutPoint *funding_txo, uint64_t highest_applied_update_id);
4183 LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const LDKChannelManager *this_arg);
4185 LDKEventsProvider ChannelManager_as_EventsProvider(const LDKChannelManager *this_arg);
4187 LDKChainListener ChannelManager_as_ChainListener(const LDKChannelManager *this_arg);
4189 LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const LDKChannelManager *this_arg);
4191 void ChannelManagerReadArgs_free(LDKChannelManagerReadArgs this_ptr);
4194 * The keys provider which will give us relevant keys. Some keys will be loaded during
4197 const LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const LDKChannelManagerReadArgs *this_ptr);
4200 * The keys provider which will give us relevant keys. Some keys will be loaded during
4203 void ChannelManagerReadArgs_set_keys_manager(LDKChannelManagerReadArgs *this_ptr, LDKKeysInterface val);
4206 * The fee_estimator for use in the ChannelManager in the future.
4208 * No calls to the FeeEstimator will be made during deserialization.
4210 const LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const LDKChannelManagerReadArgs *this_ptr);
4213 * The fee_estimator for use in the ChannelManager in the future.
4215 * No calls to the FeeEstimator will be made during deserialization.
4217 void ChannelManagerReadArgs_set_fee_estimator(LDKChannelManagerReadArgs *this_ptr, LDKFeeEstimator val);
4220 * The ManyChannelMonitor for use in the ChannelManager in the future.
4222 * No calls to the ManyChannelMonitor will be made during deserialization. It is assumed that
4223 * you have deserialized ChannelMonitors separately and will add them to your
4224 * ManyChannelMonitor after deserializing this ChannelManager.
4226 const LDKManyChannelMonitor *ChannelManagerReadArgs_get_monitor(const LDKChannelManagerReadArgs *this_ptr);
4229 * The ManyChannelMonitor for use in the ChannelManager in the future.
4231 * No calls to the ManyChannelMonitor will be made during deserialization. It is assumed that
4232 * you have deserialized ChannelMonitors separately and will add them to your
4233 * ManyChannelMonitor after deserializing this ChannelManager.
4235 void ChannelManagerReadArgs_set_monitor(LDKChannelManagerReadArgs *this_ptr, LDKManyChannelMonitor val);
4238 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
4239 * used to broadcast the latest local commitment transactions of channels which must be
4240 * force-closed during deserialization.
4242 const LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const LDKChannelManagerReadArgs *this_ptr);
4245 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
4246 * used to broadcast the latest local commitment transactions of channels which must be
4247 * force-closed during deserialization.
4249 void ChannelManagerReadArgs_set_tx_broadcaster(LDKChannelManagerReadArgs *this_ptr, LDKBroadcasterInterface val);
4252 * The Logger for use in the ChannelManager and which may be used to log information during
4255 const LDKLogger *ChannelManagerReadArgs_get_logger(const LDKChannelManagerReadArgs *this_ptr);
4258 * The Logger for use in the ChannelManager and which may be used to log information during
4261 void ChannelManagerReadArgs_set_logger(LDKChannelManagerReadArgs *this_ptr, LDKLogger val);
4264 * Default settings used for new channels. Any existing channels will continue to use the
4265 * runtime settings which were stored when the ChannelManager was serialized.
4267 LDKUserConfig ChannelManagerReadArgs_get_default_config(const LDKChannelManagerReadArgs *this_ptr);
4270 * Default settings used for new channels. Any existing channels will continue to use the
4271 * runtime settings which were stored when the ChannelManager was serialized.
4273 void ChannelManagerReadArgs_set_default_config(LDKChannelManagerReadArgs *this_ptr, LDKUserConfig val);
4276 * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
4277 * HashMap for you. This is primarily useful for C bindings where it is not practical to
4278 * populate a HashMap directly from C.
4280 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);
4282 void ChannelMonitorUpdate_free(LDKChannelMonitorUpdate this_ptr);
4285 * The sequence number of this update. Updates *must* be replayed in-order according to this
4286 * sequence number (and updates may panic if they are not). The update_id values are strictly
4287 * increasing and increase by one for each new update.
4289 * This sequence number is also used to track up to which points updates which returned
4290 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4291 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4293 uint64_t ChannelMonitorUpdate_get_update_id(const LDKChannelMonitorUpdate *this_ptr);
4296 * The sequence number of this update. Updates *must* be replayed in-order according to this
4297 * sequence number (and updates may panic if they are not). The update_id values are strictly
4298 * increasing and increase by one for each new update.
4300 * This sequence number is also used to track up to which points updates which returned
4301 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4302 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4304 void ChannelMonitorUpdate_set_update_id(LDKChannelMonitorUpdate *this_ptr, uint64_t val);
4306 LDKCVec_u8Z ChannelMonitorUpdate_write(const LDKChannelMonitorUpdate *obj);
4308 LDKChannelMonitorUpdate ChannelMonitorUpdate_read(LDKu8slice ser);
4310 void MonitorUpdateError_free(LDKMonitorUpdateError this_ptr);
4312 void MonitorEvent_free(LDKMonitorEvent this_ptr);
4314 void HTLCUpdate_free(LDKHTLCUpdate this_ptr);
4316 LDKCVec_u8Z HTLCUpdate_write(const LDKHTLCUpdate *obj);
4318 LDKHTLCUpdate HTLCUpdate_read(LDKu8slice ser);
4320 void ChannelMonitor_free(LDKChannelMonitor this_ptr);
4323 * Calls the free function if one is set
4325 void ManyChannelMonitor_free(LDKManyChannelMonitor this_ptr);
4328 * Updates a ChannelMonitor on the basis of some new information provided by the Channel
4331 * panics if the given update is not the next update by update_id.
4333 MUST_USE_RES LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(LDKChannelMonitor *this_arg, LDKChannelMonitorUpdate updates, const LDKBroadcasterInterface *broadcaster, const LDKLogger *logger);
4336 * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
4339 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const LDKChannelMonitor *this_arg);
4342 * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
4344 MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const LDKChannelMonitor *this_arg);
4347 * Get the list of HTLCs who's status has been updated on chain. This should be called by
4348 * ChannelManager via ManyChannelMonitor::get_and_clear_pending_monitor_events().
4350 MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(LDKChannelMonitor *this_arg);
4353 * Gets the list of pending events which were generated by previous actions, clearing the list
4356 * This is called by ManyChannelMonitor::get_and_clear_pending_events() and is equivalent to
4357 * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
4358 * no internal locking in ChannelMonitors.
4360 MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(LDKChannelMonitor *this_arg);
4363 * Used by ChannelManager deserialization to broadcast the latest local state if its copy of
4364 * the Channel was out-of-date. You may use it to get a broadcastable local toxic tx in case of
4365 * fallen-behind, i.e when receiving a channel_reestablish with a proof that our remote side knows
4366 * a higher revocation secret than the local commitment number we are aware of. Broadcasting these
4367 * transactions are UNSAFE, as they allow remote side to punish you. Nevertheless you may want to
4368 * broadcast them if remote don't close channel with his higher commitment transaction after a
4369 * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
4370 * out-of-band the other node operator to coordinate with him if option is available to you.
4371 * In any-case, choice is up to the user.
4373 MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_local_commitment_txn(LDKChannelMonitor *this_arg, const LDKLogger *logger);
4375 void DecodeError_free(LDKDecodeError this_ptr);
4377 void Init_free(LDKInit this_ptr);
4379 void ErrorMessage_free(LDKErrorMessage this_ptr);
4382 * The channel ID involved in the error
4384 const uint8_t (*ErrorMessage_get_channel_id(const LDKErrorMessage *this_ptr))[32];
4387 * The channel ID involved in the error
4389 void ErrorMessage_set_channel_id(LDKErrorMessage *this_ptr, LDKThirtyTwoBytes val);
4392 * A possibly human-readable error description.
4393 * The string should be sanitized before it is used (e.g. emitted to logs
4394 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
4395 * vulnerability in the terminal emulator or the logging subsystem.
4397 LDKStr ErrorMessage_get_data(const LDKErrorMessage *this_ptr);
4400 * A possibly human-readable error description.
4401 * The string should be sanitized before it is used (e.g. emitted to logs
4402 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
4403 * vulnerability in the terminal emulator or the logging subsystem.
4405 void ErrorMessage_set_data(LDKErrorMessage *this_ptr, LDKCVec_u8Z val);
4407 MUST_USE_RES LDKErrorMessage ErrorMessage_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z data_arg);
4409 void Ping_free(LDKPing this_ptr);
4412 * The desired response length
4414 uint16_t Ping_get_ponglen(const LDKPing *this_ptr);
4417 * The desired response length
4419 void Ping_set_ponglen(LDKPing *this_ptr, uint16_t val);
4422 * The ping packet size.
4423 * This field is not sent on the wire. byteslen zeros are sent.
4425 uint16_t Ping_get_byteslen(const LDKPing *this_ptr);
4428 * The ping packet size.
4429 * This field is not sent on the wire. byteslen zeros are sent.
4431 void Ping_set_byteslen(LDKPing *this_ptr, uint16_t val);
4433 MUST_USE_RES LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
4435 void Pong_free(LDKPong this_ptr);
4438 * The pong packet size.
4439 * This field is not sent on the wire. byteslen zeros are sent.
4441 uint16_t Pong_get_byteslen(const LDKPong *this_ptr);
4444 * The pong packet size.
4445 * This field is not sent on the wire. byteslen zeros are sent.
4447 void Pong_set_byteslen(LDKPong *this_ptr, uint16_t val);
4449 MUST_USE_RES LDKPong Pong_new(uint16_t byteslen_arg);
4451 void OpenChannel_free(LDKOpenChannel this_ptr);
4454 * The genesis hash of the blockchain where the channel is to be opened
4456 const uint8_t (*OpenChannel_get_chain_hash(const LDKOpenChannel *this_ptr))[32];
4459 * The genesis hash of the blockchain where the channel is to be opened
4461 void OpenChannel_set_chain_hash(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val);
4464 * A temporary channel ID, until the funding outpoint is announced
4466 const uint8_t (*OpenChannel_get_temporary_channel_id(const LDKOpenChannel *this_ptr))[32];
4469 * A temporary channel ID, until the funding outpoint is announced
4471 void OpenChannel_set_temporary_channel_id(LDKOpenChannel *this_ptr, LDKThirtyTwoBytes val);
4476 uint64_t OpenChannel_get_funding_satoshis(const LDKOpenChannel *this_ptr);
4481 void OpenChannel_set_funding_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4484 * The amount to push to the counterparty as part of the open, in milli-satoshi
4486 uint64_t OpenChannel_get_push_msat(const LDKOpenChannel *this_ptr);
4489 * The amount to push to the counterparty as part of the open, in milli-satoshi
4491 void OpenChannel_set_push_msat(LDKOpenChannel *this_ptr, uint64_t val);
4494 * The threshold below which outputs on transactions broadcast by sender will be omitted
4496 uint64_t OpenChannel_get_dust_limit_satoshis(const LDKOpenChannel *this_ptr);
4499 * The threshold below which outputs on transactions broadcast by sender will be omitted
4501 void OpenChannel_set_dust_limit_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4504 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4506 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const LDKOpenChannel *this_ptr);
4509 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4511 void OpenChannel_set_max_htlc_value_in_flight_msat(LDKOpenChannel *this_ptr, uint64_t val);
4514 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4516 uint64_t OpenChannel_get_channel_reserve_satoshis(const LDKOpenChannel *this_ptr);
4519 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4521 void OpenChannel_set_channel_reserve_satoshis(LDKOpenChannel *this_ptr, uint64_t val);
4524 * The minimum HTLC size incoming to sender, in milli-satoshi
4526 uint64_t OpenChannel_get_htlc_minimum_msat(const LDKOpenChannel *this_ptr);
4529 * The minimum HTLC size incoming to sender, in milli-satoshi
4531 void OpenChannel_set_htlc_minimum_msat(LDKOpenChannel *this_ptr, uint64_t val);
4534 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
4536 uint32_t OpenChannel_get_feerate_per_kw(const LDKOpenChannel *this_ptr);
4539 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
4541 void OpenChannel_set_feerate_per_kw(LDKOpenChannel *this_ptr, uint32_t val);
4544 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4546 uint16_t OpenChannel_get_to_self_delay(const LDKOpenChannel *this_ptr);
4549 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4551 void OpenChannel_set_to_self_delay(LDKOpenChannel *this_ptr, uint16_t val);
4554 * The maximum number of inbound HTLCs towards sender
4556 uint16_t OpenChannel_get_max_accepted_htlcs(const LDKOpenChannel *this_ptr);
4559 * The maximum number of inbound HTLCs towards sender
4561 void OpenChannel_set_max_accepted_htlcs(LDKOpenChannel *this_ptr, uint16_t val);
4564 * The sender's key controlling the funding transaction
4566 LDKPublicKey OpenChannel_get_funding_pubkey(const LDKOpenChannel *this_ptr);
4569 * The sender's key controlling the funding transaction
4571 void OpenChannel_set_funding_pubkey(LDKOpenChannel *this_ptr, LDKPublicKey val);
4574 * Used to derive a revocation key for transactions broadcast by counterparty
4576 LDKPublicKey OpenChannel_get_revocation_basepoint(const LDKOpenChannel *this_ptr);
4579 * Used to derive a revocation key for transactions broadcast by counterparty
4581 void OpenChannel_set_revocation_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4584 * A payment key to sender for transactions broadcast by counterparty
4586 LDKPublicKey OpenChannel_get_payment_point(const LDKOpenChannel *this_ptr);
4589 * A payment key to sender for transactions broadcast by counterparty
4591 void OpenChannel_set_payment_point(LDKOpenChannel *this_ptr, LDKPublicKey val);
4594 * Used to derive a payment key to sender for transactions broadcast by sender
4596 LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const LDKOpenChannel *this_ptr);
4599 * Used to derive a payment key to sender for transactions broadcast by sender
4601 void OpenChannel_set_delayed_payment_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4604 * Used to derive an HTLC payment key to sender
4606 LDKPublicKey OpenChannel_get_htlc_basepoint(const LDKOpenChannel *this_ptr);
4609 * Used to derive an HTLC payment key to sender
4611 void OpenChannel_set_htlc_basepoint(LDKOpenChannel *this_ptr, LDKPublicKey val);
4614 * The first to-be-broadcast-by-sender transaction's per commitment point
4616 LDKPublicKey OpenChannel_get_first_per_commitment_point(const LDKOpenChannel *this_ptr);
4619 * The first to-be-broadcast-by-sender transaction's per commitment point
4621 void OpenChannel_set_first_per_commitment_point(LDKOpenChannel *this_ptr, LDKPublicKey val);
4626 uint8_t OpenChannel_get_channel_flags(const LDKOpenChannel *this_ptr);
4631 void OpenChannel_set_channel_flags(LDKOpenChannel *this_ptr, uint8_t val);
4633 void AcceptChannel_free(LDKAcceptChannel this_ptr);
4636 * A temporary channel ID, until the funding outpoint is announced
4638 const uint8_t (*AcceptChannel_get_temporary_channel_id(const LDKAcceptChannel *this_ptr))[32];
4641 * A temporary channel ID, until the funding outpoint is announced
4643 void AcceptChannel_set_temporary_channel_id(LDKAcceptChannel *this_ptr, LDKThirtyTwoBytes val);
4646 * The threshold below which outputs on transactions broadcast by sender will be omitted
4648 uint64_t AcceptChannel_get_dust_limit_satoshis(const LDKAcceptChannel *this_ptr);
4651 * The threshold below which outputs on transactions broadcast by sender will be omitted
4653 void AcceptChannel_set_dust_limit_satoshis(LDKAcceptChannel *this_ptr, uint64_t val);
4656 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4658 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const LDKAcceptChannel *this_ptr);
4661 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
4663 void AcceptChannel_set_max_htlc_value_in_flight_msat(LDKAcceptChannel *this_ptr, uint64_t val);
4666 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4668 uint64_t AcceptChannel_get_channel_reserve_satoshis(const LDKAcceptChannel *this_ptr);
4671 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
4673 void AcceptChannel_set_channel_reserve_satoshis(LDKAcceptChannel *this_ptr, uint64_t val);
4676 * The minimum HTLC size incoming to sender, in milli-satoshi
4678 uint64_t AcceptChannel_get_htlc_minimum_msat(const LDKAcceptChannel *this_ptr);
4681 * The minimum HTLC size incoming to sender, in milli-satoshi
4683 void AcceptChannel_set_htlc_minimum_msat(LDKAcceptChannel *this_ptr, uint64_t val);
4686 * Minimum depth of the funding transaction before the channel is considered open
4688 uint32_t AcceptChannel_get_minimum_depth(const LDKAcceptChannel *this_ptr);
4691 * Minimum depth of the funding transaction before the channel is considered open
4693 void AcceptChannel_set_minimum_depth(LDKAcceptChannel *this_ptr, uint32_t val);
4696 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4698 uint16_t AcceptChannel_get_to_self_delay(const LDKAcceptChannel *this_ptr);
4701 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
4703 void AcceptChannel_set_to_self_delay(LDKAcceptChannel *this_ptr, uint16_t val);
4706 * The maximum number of inbound HTLCs towards sender
4708 uint16_t AcceptChannel_get_max_accepted_htlcs(const LDKAcceptChannel *this_ptr);
4711 * The maximum number of inbound HTLCs towards sender
4713 void AcceptChannel_set_max_accepted_htlcs(LDKAcceptChannel *this_ptr, uint16_t val);
4716 * The sender's key controlling the funding transaction
4718 LDKPublicKey AcceptChannel_get_funding_pubkey(const LDKAcceptChannel *this_ptr);
4721 * The sender's key controlling the funding transaction
4723 void AcceptChannel_set_funding_pubkey(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4726 * Used to derive a revocation key for transactions broadcast by counterparty
4728 LDKPublicKey AcceptChannel_get_revocation_basepoint(const LDKAcceptChannel *this_ptr);
4731 * Used to derive a revocation key for transactions broadcast by counterparty
4733 void AcceptChannel_set_revocation_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4736 * A payment key to sender for transactions broadcast by counterparty
4738 LDKPublicKey AcceptChannel_get_payment_point(const LDKAcceptChannel *this_ptr);
4741 * A payment key to sender for transactions broadcast by counterparty
4743 void AcceptChannel_set_payment_point(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4746 * Used to derive a payment key to sender for transactions broadcast by sender
4748 LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const LDKAcceptChannel *this_ptr);
4751 * Used to derive a payment key to sender for transactions broadcast by sender
4753 void AcceptChannel_set_delayed_payment_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4756 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
4758 LDKPublicKey AcceptChannel_get_htlc_basepoint(const LDKAcceptChannel *this_ptr);
4761 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
4763 void AcceptChannel_set_htlc_basepoint(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4766 * The first to-be-broadcast-by-sender transaction's per commitment point
4768 LDKPublicKey AcceptChannel_get_first_per_commitment_point(const LDKAcceptChannel *this_ptr);
4771 * The first to-be-broadcast-by-sender transaction's per commitment point
4773 void AcceptChannel_set_first_per_commitment_point(LDKAcceptChannel *this_ptr, LDKPublicKey val);
4775 void FundingCreated_free(LDKFundingCreated this_ptr);
4778 * A temporary channel ID, until the funding is established
4780 const uint8_t (*FundingCreated_get_temporary_channel_id(const LDKFundingCreated *this_ptr))[32];
4783 * A temporary channel ID, until the funding is established
4785 void FundingCreated_set_temporary_channel_id(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val);
4788 * The funding transaction ID
4790 const uint8_t (*FundingCreated_get_funding_txid(const LDKFundingCreated *this_ptr))[32];
4793 * The funding transaction ID
4795 void FundingCreated_set_funding_txid(LDKFundingCreated *this_ptr, LDKThirtyTwoBytes val);
4798 * The specific output index funding this channel
4800 uint16_t FundingCreated_get_funding_output_index(const LDKFundingCreated *this_ptr);
4803 * The specific output index funding this channel
4805 void FundingCreated_set_funding_output_index(LDKFundingCreated *this_ptr, uint16_t val);
4808 * The signature of the channel initiator (funder) on the funding transaction
4810 LDKSignature FundingCreated_get_signature(const LDKFundingCreated *this_ptr);
4813 * The signature of the channel initiator (funder) on the funding transaction
4815 void FundingCreated_set_signature(LDKFundingCreated *this_ptr, LDKSignature val);
4817 MUST_USE_RES LDKFundingCreated FundingCreated_new(LDKThirtyTwoBytes temporary_channel_id_arg, LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, LDKSignature signature_arg);
4819 void FundingSigned_free(LDKFundingSigned this_ptr);
4824 const uint8_t (*FundingSigned_get_channel_id(const LDKFundingSigned *this_ptr))[32];
4829 void FundingSigned_set_channel_id(LDKFundingSigned *this_ptr, LDKThirtyTwoBytes val);
4832 * The signature of the channel acceptor (fundee) on the funding transaction
4834 LDKSignature FundingSigned_get_signature(const LDKFundingSigned *this_ptr);
4837 * The signature of the channel acceptor (fundee) on the funding transaction
4839 void FundingSigned_set_signature(LDKFundingSigned *this_ptr, LDKSignature val);
4841 MUST_USE_RES LDKFundingSigned FundingSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg);
4843 void FundingLocked_free(LDKFundingLocked this_ptr);
4848 const uint8_t (*FundingLocked_get_channel_id(const LDKFundingLocked *this_ptr))[32];
4853 void FundingLocked_set_channel_id(LDKFundingLocked *this_ptr, LDKThirtyTwoBytes val);
4856 * The per-commitment point of the second commitment transaction
4858 LDKPublicKey FundingLocked_get_next_per_commitment_point(const LDKFundingLocked *this_ptr);
4861 * The per-commitment point of the second commitment transaction
4863 void FundingLocked_set_next_per_commitment_point(LDKFundingLocked *this_ptr, LDKPublicKey val);
4865 MUST_USE_RES LDKFundingLocked FundingLocked_new(LDKThirtyTwoBytes channel_id_arg, LDKPublicKey next_per_commitment_point_arg);
4867 void Shutdown_free(LDKShutdown this_ptr);
4872 const uint8_t (*Shutdown_get_channel_id(const LDKShutdown *this_ptr))[32];
4877 void Shutdown_set_channel_id(LDKShutdown *this_ptr, LDKThirtyTwoBytes val);
4880 * The destination of this peer's funds on closing.
4881 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
4883 LDKu8slice Shutdown_get_scriptpubkey(const LDKShutdown *this_ptr);
4886 * The destination of this peer's funds on closing.
4887 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
4889 void Shutdown_set_scriptpubkey(LDKShutdown *this_ptr, LDKCVec_u8Z val);
4891 MUST_USE_RES LDKShutdown Shutdown_new(LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z scriptpubkey_arg);
4893 void ClosingSigned_free(LDKClosingSigned this_ptr);
4898 const uint8_t (*ClosingSigned_get_channel_id(const LDKClosingSigned *this_ptr))[32];
4903 void ClosingSigned_set_channel_id(LDKClosingSigned *this_ptr, LDKThirtyTwoBytes val);
4906 * The proposed total fee for the closing transaction
4908 uint64_t ClosingSigned_get_fee_satoshis(const LDKClosingSigned *this_ptr);
4911 * The proposed total fee for the closing transaction
4913 void ClosingSigned_set_fee_satoshis(LDKClosingSigned *this_ptr, uint64_t val);
4916 * A signature on the closing transaction
4918 LDKSignature ClosingSigned_get_signature(const LDKClosingSigned *this_ptr);
4921 * A signature on the closing transaction
4923 void ClosingSigned_set_signature(LDKClosingSigned *this_ptr, LDKSignature val);
4925 MUST_USE_RES LDKClosingSigned ClosingSigned_new(LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, LDKSignature signature_arg);
4927 void UpdateAddHTLC_free(LDKUpdateAddHTLC this_ptr);
4932 const uint8_t (*UpdateAddHTLC_get_channel_id(const LDKUpdateAddHTLC *this_ptr))[32];
4937 void UpdateAddHTLC_set_channel_id(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val);
4942 uint64_t UpdateAddHTLC_get_htlc_id(const LDKUpdateAddHTLC *this_ptr);
4947 void UpdateAddHTLC_set_htlc_id(LDKUpdateAddHTLC *this_ptr, uint64_t val);
4950 * The HTLC value in milli-satoshi
4952 uint64_t UpdateAddHTLC_get_amount_msat(const LDKUpdateAddHTLC *this_ptr);
4955 * The HTLC value in milli-satoshi
4957 void UpdateAddHTLC_set_amount_msat(LDKUpdateAddHTLC *this_ptr, uint64_t val);
4960 * The payment hash, the pre-image of which controls HTLC redemption
4962 const uint8_t (*UpdateAddHTLC_get_payment_hash(const LDKUpdateAddHTLC *this_ptr))[32];
4965 * The payment hash, the pre-image of which controls HTLC redemption
4967 void UpdateAddHTLC_set_payment_hash(LDKUpdateAddHTLC *this_ptr, LDKThirtyTwoBytes val);
4970 * The expiry height of the HTLC
4972 uint32_t UpdateAddHTLC_get_cltv_expiry(const LDKUpdateAddHTLC *this_ptr);
4975 * The expiry height of the HTLC
4977 void UpdateAddHTLC_set_cltv_expiry(LDKUpdateAddHTLC *this_ptr, uint32_t val);
4979 void UpdateFulfillHTLC_free(LDKUpdateFulfillHTLC this_ptr);
4984 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const LDKUpdateFulfillHTLC *this_ptr))[32];
4989 void UpdateFulfillHTLC_set_channel_id(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val);
4994 uint64_t UpdateFulfillHTLC_get_htlc_id(const LDKUpdateFulfillHTLC *this_ptr);
4999 void UpdateFulfillHTLC_set_htlc_id(LDKUpdateFulfillHTLC *this_ptr, uint64_t val);
5002 * The pre-image of the payment hash, allowing HTLC redemption
5004 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const LDKUpdateFulfillHTLC *this_ptr))[32];
5007 * The pre-image of the payment hash, allowing HTLC redemption
5009 void UpdateFulfillHTLC_set_payment_preimage(LDKUpdateFulfillHTLC *this_ptr, LDKThirtyTwoBytes val);
5011 MUST_USE_RES LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, LDKThirtyTwoBytes payment_preimage_arg);
5013 void UpdateFailHTLC_free(LDKUpdateFailHTLC this_ptr);
5018 const uint8_t (*UpdateFailHTLC_get_channel_id(const LDKUpdateFailHTLC *this_ptr))[32];
5023 void UpdateFailHTLC_set_channel_id(LDKUpdateFailHTLC *this_ptr, LDKThirtyTwoBytes val);
5028 uint64_t UpdateFailHTLC_get_htlc_id(const LDKUpdateFailHTLC *this_ptr);
5033 void UpdateFailHTLC_set_htlc_id(LDKUpdateFailHTLC *this_ptr, uint64_t val);
5035 void UpdateFailMalformedHTLC_free(LDKUpdateFailMalformedHTLC this_ptr);
5040 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const LDKUpdateFailMalformedHTLC *this_ptr))[32];
5045 void UpdateFailMalformedHTLC_set_channel_id(LDKUpdateFailMalformedHTLC *this_ptr, LDKThirtyTwoBytes val);
5050 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const LDKUpdateFailMalformedHTLC *this_ptr);
5055 void UpdateFailMalformedHTLC_set_htlc_id(LDKUpdateFailMalformedHTLC *this_ptr, uint64_t val);
5060 uint16_t UpdateFailMalformedHTLC_get_failure_code(const LDKUpdateFailMalformedHTLC *this_ptr);
5065 void UpdateFailMalformedHTLC_set_failure_code(LDKUpdateFailMalformedHTLC *this_ptr, uint16_t val);
5067 void CommitmentSigned_free(LDKCommitmentSigned this_ptr);
5072 const uint8_t (*CommitmentSigned_get_channel_id(const LDKCommitmentSigned *this_ptr))[32];
5077 void CommitmentSigned_set_channel_id(LDKCommitmentSigned *this_ptr, LDKThirtyTwoBytes val);
5080 * A signature on the commitment transaction
5082 LDKSignature CommitmentSigned_get_signature(const LDKCommitmentSigned *this_ptr);
5085 * A signature on the commitment transaction
5087 void CommitmentSigned_set_signature(LDKCommitmentSigned *this_ptr, LDKSignature val);
5090 * Signatures on the HTLC transactions
5092 void CommitmentSigned_set_htlc_signatures(LDKCommitmentSigned *this_ptr, LDKCVec_SignatureZ val);
5094 MUST_USE_RES LDKCommitmentSigned CommitmentSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg, LDKCVec_SignatureZ htlc_signatures_arg);
5096 void RevokeAndACK_free(LDKRevokeAndACK this_ptr);
5101 const uint8_t (*RevokeAndACK_get_channel_id(const LDKRevokeAndACK *this_ptr))[32];
5106 void RevokeAndACK_set_channel_id(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val);
5109 * The secret corresponding to the per-commitment point
5111 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const LDKRevokeAndACK *this_ptr))[32];
5114 * The secret corresponding to the per-commitment point
5116 void RevokeAndACK_set_per_commitment_secret(LDKRevokeAndACK *this_ptr, LDKThirtyTwoBytes val);
5119 * The next sender-broadcast commitment transaction's per-commitment point
5121 LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const LDKRevokeAndACK *this_ptr);
5124 * The next sender-broadcast commitment transaction's per-commitment point
5126 void RevokeAndACK_set_next_per_commitment_point(LDKRevokeAndACK *this_ptr, LDKPublicKey val);
5128 MUST_USE_RES LDKRevokeAndACK RevokeAndACK_new(LDKThirtyTwoBytes channel_id_arg, LDKThirtyTwoBytes per_commitment_secret_arg, LDKPublicKey next_per_commitment_point_arg);
5130 void UpdateFee_free(LDKUpdateFee this_ptr);
5135 const uint8_t (*UpdateFee_get_channel_id(const LDKUpdateFee *this_ptr))[32];
5140 void UpdateFee_set_channel_id(LDKUpdateFee *this_ptr, LDKThirtyTwoBytes val);
5143 * Fee rate per 1000-weight of the transaction
5145 uint32_t UpdateFee_get_feerate_per_kw(const LDKUpdateFee *this_ptr);
5148 * Fee rate per 1000-weight of the transaction
5150 void UpdateFee_set_feerate_per_kw(LDKUpdateFee *this_ptr, uint32_t val);
5152 MUST_USE_RES LDKUpdateFee UpdateFee_new(LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
5154 void DataLossProtect_free(LDKDataLossProtect this_ptr);
5157 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5158 * belonging to the recipient
5160 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const LDKDataLossProtect *this_ptr))[32];
5163 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
5164 * belonging to the recipient
5166 void DataLossProtect_set_your_last_per_commitment_secret(LDKDataLossProtect *this_ptr, LDKThirtyTwoBytes val);
5169 * The sender's per-commitment point for their current commitment transaction
5171 LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const LDKDataLossProtect *this_ptr);
5174 * The sender's per-commitment point for their current commitment transaction
5176 void DataLossProtect_set_my_current_per_commitment_point(LDKDataLossProtect *this_ptr, LDKPublicKey val);
5178 MUST_USE_RES LDKDataLossProtect DataLossProtect_new(LDKThirtyTwoBytes your_last_per_commitment_secret_arg, LDKPublicKey my_current_per_commitment_point_arg);
5180 void ChannelReestablish_free(LDKChannelReestablish this_ptr);
5185 const uint8_t (*ChannelReestablish_get_channel_id(const LDKChannelReestablish *this_ptr))[32];
5190 void ChannelReestablish_set_channel_id(LDKChannelReestablish *this_ptr, LDKThirtyTwoBytes val);
5193 * The next commitment number for the sender
5195 uint64_t ChannelReestablish_get_next_local_commitment_number(const LDKChannelReestablish *this_ptr);
5198 * The next commitment number for the sender
5200 void ChannelReestablish_set_next_local_commitment_number(LDKChannelReestablish *this_ptr, uint64_t val);
5203 * The next commitment number for the recipient
5205 uint64_t ChannelReestablish_get_next_remote_commitment_number(const LDKChannelReestablish *this_ptr);
5208 * The next commitment number for the recipient
5210 void ChannelReestablish_set_next_remote_commitment_number(LDKChannelReestablish *this_ptr, uint64_t val);
5212 void AnnouncementSignatures_free(LDKAnnouncementSignatures this_ptr);
5217 const uint8_t (*AnnouncementSignatures_get_channel_id(const LDKAnnouncementSignatures *this_ptr))[32];
5222 void AnnouncementSignatures_set_channel_id(LDKAnnouncementSignatures *this_ptr, LDKThirtyTwoBytes val);
5225 * The short channel ID
5227 uint64_t AnnouncementSignatures_get_short_channel_id(const LDKAnnouncementSignatures *this_ptr);
5230 * The short channel ID
5232 void AnnouncementSignatures_set_short_channel_id(LDKAnnouncementSignatures *this_ptr, uint64_t val);
5235 * A signature by the node key
5237 LDKSignature AnnouncementSignatures_get_node_signature(const LDKAnnouncementSignatures *this_ptr);
5240 * A signature by the node key
5242 void AnnouncementSignatures_set_node_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val);
5245 * A signature by the funding key
5247 LDKSignature AnnouncementSignatures_get_bitcoin_signature(const LDKAnnouncementSignatures *this_ptr);
5250 * A signature by the funding key
5252 void AnnouncementSignatures_set_bitcoin_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val);
5254 MUST_USE_RES LDKAnnouncementSignatures AnnouncementSignatures_new(LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, LDKSignature node_signature_arg, LDKSignature bitcoin_signature_arg);
5256 void NetAddress_free(LDKNetAddress this_ptr);
5258 void UnsignedNodeAnnouncement_free(LDKUnsignedNodeAnnouncement this_ptr);
5261 * A strictly monotonic announcement counter, with gaps allowed
5263 uint32_t UnsignedNodeAnnouncement_get_timestamp(const LDKUnsignedNodeAnnouncement *this_ptr);
5266 * A strictly monotonic announcement counter, with gaps allowed
5268 void UnsignedNodeAnnouncement_set_timestamp(LDKUnsignedNodeAnnouncement *this_ptr, uint32_t val);
5271 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
5274 LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const LDKUnsignedNodeAnnouncement *this_ptr);
5277 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
5280 void UnsignedNodeAnnouncement_set_node_id(LDKUnsignedNodeAnnouncement *this_ptr, LDKPublicKey val);
5283 * An RGB color for UI purposes
5285 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const LDKUnsignedNodeAnnouncement *this_ptr))[3];
5288 * An RGB color for UI purposes
5290 void UnsignedNodeAnnouncement_set_rgb(LDKUnsignedNodeAnnouncement *this_ptr, LDKThreeBytes val);
5293 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
5296 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const LDKUnsignedNodeAnnouncement *this_ptr))[32];
5299 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
5302 void UnsignedNodeAnnouncement_set_alias(LDKUnsignedNodeAnnouncement *this_ptr, LDKThirtyTwoBytes val);
5305 * List of addresses on which this node is reachable
5307 void UnsignedNodeAnnouncement_set_addresses(LDKUnsignedNodeAnnouncement *this_ptr, LDKCVec_NetAddressZ val);
5309 void NodeAnnouncement_free(LDKNodeAnnouncement this_ptr);
5312 * The signature by the node key
5314 LDKSignature NodeAnnouncement_get_signature(const LDKNodeAnnouncement *this_ptr);
5317 * The signature by the node key
5319 void NodeAnnouncement_set_signature(LDKNodeAnnouncement *this_ptr, LDKSignature val);
5322 * The actual content of the announcement
5324 LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const LDKNodeAnnouncement *this_ptr);
5327 * The actual content of the announcement
5329 void NodeAnnouncement_set_contents(LDKNodeAnnouncement *this_ptr, LDKUnsignedNodeAnnouncement val);
5331 MUST_USE_RES LDKNodeAnnouncement NodeAnnouncement_new(LDKSignature signature_arg, LDKUnsignedNodeAnnouncement contents_arg);
5333 void UnsignedChannelAnnouncement_free(LDKUnsignedChannelAnnouncement this_ptr);
5336 * The genesis hash of the blockchain where the channel is to be opened
5338 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const LDKUnsignedChannelAnnouncement *this_ptr))[32];
5341 * The genesis hash of the blockchain where the channel is to be opened
5343 void UnsignedChannelAnnouncement_set_chain_hash(LDKUnsignedChannelAnnouncement *this_ptr, LDKThirtyTwoBytes val);
5346 * The short channel ID
5348 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const LDKUnsignedChannelAnnouncement *this_ptr);
5351 * The short channel ID
5353 void UnsignedChannelAnnouncement_set_short_channel_id(LDKUnsignedChannelAnnouncement *this_ptr, uint64_t val);
5356 * One of the two node_ids which are endpoints of this channel
5358 LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const LDKUnsignedChannelAnnouncement *this_ptr);
5361 * One of the two node_ids which are endpoints of this channel
5363 void UnsignedChannelAnnouncement_set_node_id_1(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5366 * The other of the two node_ids which are endpoints of this channel
5368 LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const LDKUnsignedChannelAnnouncement *this_ptr);
5371 * The other of the two node_ids which are endpoints of this channel
5373 void UnsignedChannelAnnouncement_set_node_id_2(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5376 * The funding key for the first node
5378 LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const LDKUnsignedChannelAnnouncement *this_ptr);
5381 * The funding key for the first node
5383 void UnsignedChannelAnnouncement_set_bitcoin_key_1(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5386 * The funding key for the second node
5388 LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const LDKUnsignedChannelAnnouncement *this_ptr);
5391 * The funding key for the second node
5393 void UnsignedChannelAnnouncement_set_bitcoin_key_2(LDKUnsignedChannelAnnouncement *this_ptr, LDKPublicKey val);
5395 void ChannelAnnouncement_free(LDKChannelAnnouncement this_ptr);
5398 * Authentication of the announcement by the first public node
5400 LDKSignature ChannelAnnouncement_get_node_signature_1(const LDKChannelAnnouncement *this_ptr);
5403 * Authentication of the announcement by the first public node
5405 void ChannelAnnouncement_set_node_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5408 * Authentication of the announcement by the second public node
5410 LDKSignature ChannelAnnouncement_get_node_signature_2(const LDKChannelAnnouncement *this_ptr);
5413 * Authentication of the announcement by the second public node
5415 void ChannelAnnouncement_set_node_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5418 * Proof of funding UTXO ownership by the first public node
5420 LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const LDKChannelAnnouncement *this_ptr);
5423 * Proof of funding UTXO ownership by the first public node
5425 void ChannelAnnouncement_set_bitcoin_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5428 * Proof of funding UTXO ownership by the second public node
5430 LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const LDKChannelAnnouncement *this_ptr);
5433 * Proof of funding UTXO ownership by the second public node
5435 void ChannelAnnouncement_set_bitcoin_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val);
5438 * The actual announcement
5440 LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const LDKChannelAnnouncement *this_ptr);
5443 * The actual announcement
5445 void ChannelAnnouncement_set_contents(LDKChannelAnnouncement *this_ptr, LDKUnsignedChannelAnnouncement val);
5447 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);
5449 void UnsignedChannelUpdate_free(LDKUnsignedChannelUpdate this_ptr);
5452 * The genesis hash of the blockchain where the channel is to be opened
5454 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const LDKUnsignedChannelUpdate *this_ptr))[32];
5457 * The genesis hash of the blockchain where the channel is to be opened
5459 void UnsignedChannelUpdate_set_chain_hash(LDKUnsignedChannelUpdate *this_ptr, LDKThirtyTwoBytes val);
5462 * The short channel ID
5464 uint64_t UnsignedChannelUpdate_get_short_channel_id(const LDKUnsignedChannelUpdate *this_ptr);
5467 * The short channel ID
5469 void UnsignedChannelUpdate_set_short_channel_id(LDKUnsignedChannelUpdate *this_ptr, uint64_t val);
5472 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
5474 uint32_t UnsignedChannelUpdate_get_timestamp(const LDKUnsignedChannelUpdate *this_ptr);
5477 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
5479 void UnsignedChannelUpdate_set_timestamp(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5484 uint8_t UnsignedChannelUpdate_get_flags(const LDKUnsignedChannelUpdate *this_ptr);
5489 void UnsignedChannelUpdate_set_flags(LDKUnsignedChannelUpdate *this_ptr, uint8_t val);
5492 * The number of blocks to subtract from incoming HTLC cltv_expiry values
5494 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const LDKUnsignedChannelUpdate *this_ptr);
5497 * The number of blocks to subtract from incoming HTLC cltv_expiry values
5499 void UnsignedChannelUpdate_set_cltv_expiry_delta(LDKUnsignedChannelUpdate *this_ptr, uint16_t val);
5502 * The minimum HTLC size incoming to sender, in milli-satoshi
5504 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const LDKUnsignedChannelUpdate *this_ptr);
5507 * The minimum HTLC size incoming to sender, in milli-satoshi
5509 void UnsignedChannelUpdate_set_htlc_minimum_msat(LDKUnsignedChannelUpdate *this_ptr, uint64_t val);
5512 * The base HTLC fee charged by sender, in milli-satoshi
5514 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const LDKUnsignedChannelUpdate *this_ptr);
5517 * The base HTLC fee charged by sender, in milli-satoshi
5519 void UnsignedChannelUpdate_set_fee_base_msat(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5522 * The amount to fee multiplier, in micro-satoshi
5524 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const LDKUnsignedChannelUpdate *this_ptr);
5527 * The amount to fee multiplier, in micro-satoshi
5529 void UnsignedChannelUpdate_set_fee_proportional_millionths(LDKUnsignedChannelUpdate *this_ptr, uint32_t val);
5531 void ChannelUpdate_free(LDKChannelUpdate this_ptr);
5534 * A signature of the channel update
5536 LDKSignature ChannelUpdate_get_signature(const LDKChannelUpdate *this_ptr);
5539 * A signature of the channel update
5541 void ChannelUpdate_set_signature(LDKChannelUpdate *this_ptr, LDKSignature val);
5544 * The actual channel update
5546 LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const LDKChannelUpdate *this_ptr);
5549 * The actual channel update
5551 void ChannelUpdate_set_contents(LDKChannelUpdate *this_ptr, LDKUnsignedChannelUpdate val);
5553 MUST_USE_RES LDKChannelUpdate ChannelUpdate_new(LDKSignature signature_arg, LDKUnsignedChannelUpdate contents_arg);
5555 void ErrorAction_free(LDKErrorAction this_ptr);
5557 void LightningError_free(LDKLightningError this_ptr);
5560 * A human-readable message describing the error
5562 LDKStr LightningError_get_err(const LDKLightningError *this_ptr);
5565 * A human-readable message describing the error
5567 void LightningError_set_err(LDKLightningError *this_ptr, LDKCVec_u8Z val);
5570 * The action which should be taken against the offending peer.
5572 LDKErrorAction LightningError_get_action(const LDKLightningError *this_ptr);
5575 * The action which should be taken against the offending peer.
5577 void LightningError_set_action(LDKLightningError *this_ptr, LDKErrorAction val);
5579 MUST_USE_RES LDKLightningError LightningError_new(LDKCVec_u8Z err_arg, LDKErrorAction action_arg);
5581 void CommitmentUpdate_free(LDKCommitmentUpdate this_ptr);
5584 * update_add_htlc messages which should be sent
5586 void CommitmentUpdate_set_update_add_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateAddHTLCZ val);
5589 * update_fulfill_htlc messages which should be sent
5591 void CommitmentUpdate_set_update_fulfill_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFulfillHTLCZ val);
5594 * update_fail_htlc messages which should be sent
5596 void CommitmentUpdate_set_update_fail_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFailHTLCZ val);
5599 * update_fail_malformed_htlc messages which should be sent
5601 void CommitmentUpdate_set_update_fail_malformed_htlcs(LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFailMalformedHTLCZ val);
5604 * An update_fee message which should be sent
5606 LDKUpdateFee CommitmentUpdate_get_update_fee(const LDKCommitmentUpdate *this_ptr);
5609 * An update_fee message which should be sent
5611 void CommitmentUpdate_set_update_fee(LDKCommitmentUpdate *this_ptr, LDKUpdateFee val);
5614 * Finally, the commitment_signed message which should be sent
5616 LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const LDKCommitmentUpdate *this_ptr);
5619 * Finally, the commitment_signed message which should be sent
5621 void CommitmentUpdate_set_commitment_signed(LDKCommitmentUpdate *this_ptr, LDKCommitmentSigned val);
5623 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);
5625 void HTLCFailChannelUpdate_free(LDKHTLCFailChannelUpdate this_ptr);
5628 * Calls the free function if one is set
5630 void ChannelMessageHandler_free(LDKChannelMessageHandler this_ptr);
5633 * Calls the free function if one is set
5635 void RoutingMessageHandler_free(LDKRoutingMessageHandler this_ptr);
5637 LDKCVec_u8Z AcceptChannel_write(const LDKAcceptChannel *obj);
5639 LDKAcceptChannel AcceptChannel_read(LDKu8slice ser);
5641 LDKCVec_u8Z AnnouncementSignatures_write(const LDKAnnouncementSignatures *obj);
5643 LDKAnnouncementSignatures AnnouncementSignatures_read(LDKu8slice ser);
5645 LDKCVec_u8Z ChannelReestablish_write(const LDKChannelReestablish *obj);
5647 LDKChannelReestablish ChannelReestablish_read(LDKu8slice ser);
5649 LDKCVec_u8Z ClosingSigned_write(const LDKClosingSigned *obj);
5651 LDKClosingSigned ClosingSigned_read(LDKu8slice ser);
5653 LDKCVec_u8Z CommitmentSigned_write(const LDKCommitmentSigned *obj);
5655 LDKCommitmentSigned CommitmentSigned_read(LDKu8slice ser);
5657 LDKCVec_u8Z FundingCreated_write(const LDKFundingCreated *obj);
5659 LDKFundingCreated FundingCreated_read(LDKu8slice ser);
5661 LDKCVec_u8Z FundingSigned_write(const LDKFundingSigned *obj);
5663 LDKFundingSigned FundingSigned_read(LDKu8slice ser);
5665 LDKCVec_u8Z FundingLocked_write(const LDKFundingLocked *obj);
5667 LDKFundingLocked FundingLocked_read(LDKu8slice ser);
5669 LDKCVec_u8Z Init_write(const LDKInit *obj);
5671 LDKInit Init_read(LDKu8slice ser);
5673 LDKCVec_u8Z OpenChannel_write(const LDKOpenChannel *obj);
5675 LDKOpenChannel OpenChannel_read(LDKu8slice ser);
5677 LDKCVec_u8Z RevokeAndACK_write(const LDKRevokeAndACK *obj);
5679 LDKRevokeAndACK RevokeAndACK_read(LDKu8slice ser);
5681 LDKCVec_u8Z Shutdown_write(const LDKShutdown *obj);
5683 LDKShutdown Shutdown_read(LDKu8slice ser);
5685 LDKCVec_u8Z UpdateFailHTLC_write(const LDKUpdateFailHTLC *obj);
5687 LDKUpdateFailHTLC UpdateFailHTLC_read(LDKu8slice ser);
5689 LDKCVec_u8Z UpdateFailMalformedHTLC_write(const LDKUpdateFailMalformedHTLC *obj);
5691 LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(LDKu8slice ser);
5693 LDKCVec_u8Z UpdateFee_write(const LDKUpdateFee *obj);
5695 LDKUpdateFee UpdateFee_read(LDKu8slice ser);
5697 LDKCVec_u8Z UpdateFulfillHTLC_write(const LDKUpdateFulfillHTLC *obj);
5699 LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(LDKu8slice ser);
5701 LDKCVec_u8Z UpdateAddHTLC_write(const LDKUpdateAddHTLC *obj);
5703 LDKUpdateAddHTLC UpdateAddHTLC_read(LDKu8slice ser);
5705 LDKCVec_u8Z Ping_write(const LDKPing *obj);
5707 LDKPing Ping_read(LDKu8slice ser);
5709 LDKCVec_u8Z Pong_write(const LDKPong *obj);
5711 LDKPong Pong_read(LDKu8slice ser);
5713 LDKCVec_u8Z UnsignedChannelAnnouncement_write(const LDKUnsignedChannelAnnouncement *obj);
5715 LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_read(LDKu8slice ser);
5717 LDKCVec_u8Z ChannelAnnouncement_write(const LDKChannelAnnouncement *obj);
5719 LDKChannelAnnouncement ChannelAnnouncement_read(LDKu8slice ser);
5721 LDKCVec_u8Z UnsignedChannelUpdate_write(const LDKUnsignedChannelUpdate *obj);
5723 LDKUnsignedChannelUpdate UnsignedChannelUpdate_read(LDKu8slice ser);
5725 LDKCVec_u8Z ChannelUpdate_write(const LDKChannelUpdate *obj);
5727 LDKChannelUpdate ChannelUpdate_read(LDKu8slice ser);
5729 LDKCVec_u8Z ErrorMessage_write(const LDKErrorMessage *obj);
5731 LDKErrorMessage ErrorMessage_read(LDKu8slice ser);
5733 LDKCVec_u8Z UnsignedNodeAnnouncement_write(const LDKUnsignedNodeAnnouncement *obj);
5735 LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_read(LDKu8slice ser);
5737 LDKCVec_u8Z NodeAnnouncement_write(const LDKNodeAnnouncement *obj);
5739 LDKNodeAnnouncement NodeAnnouncement_read(LDKu8slice ser);
5741 void MessageHandler_free(LDKMessageHandler this_ptr);
5744 * A message handler which handles messages specific to channels. Usually this is just a
5745 * ChannelManager object.
5747 const LDKChannelMessageHandler *MessageHandler_get_chan_handler(const LDKMessageHandler *this_ptr);
5750 * A message handler which handles messages specific to channels. Usually this is just a
5751 * ChannelManager object.
5753 void MessageHandler_set_chan_handler(LDKMessageHandler *this_ptr, LDKChannelMessageHandler val);
5756 * A message handler which handles messages updating our knowledge of the network channel
5757 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
5759 const LDKRoutingMessageHandler *MessageHandler_get_route_handler(const LDKMessageHandler *this_ptr);
5762 * A message handler which handles messages updating our knowledge of the network channel
5763 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
5765 void MessageHandler_set_route_handler(LDKMessageHandler *this_ptr, LDKRoutingMessageHandler val);
5767 MUST_USE_RES LDKMessageHandler MessageHandler_new(LDKChannelMessageHandler chan_handler_arg, LDKRoutingMessageHandler route_handler_arg);
5770 * Calls the free function if one is set
5772 void SocketDescriptor_free(LDKSocketDescriptor this_ptr);
5774 void PeerHandleError_free(LDKPeerHandleError this_ptr);
5777 * Used to indicate that we probably can't make any future connections to this peer, implying
5778 * we should go ahead and force-close any channels we have with it.
5780 bool PeerHandleError_get_no_connection_possible(const LDKPeerHandleError *this_ptr);
5783 * Used to indicate that we probably can't make any future connections to this peer, implying
5784 * we should go ahead and force-close any channels we have with it.
5786 void PeerHandleError_set_no_connection_possible(LDKPeerHandleError *this_ptr, bool val);
5788 MUST_USE_RES LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
5790 void PeerManager_free(LDKPeerManager this_ptr);
5793 * Constructs a new PeerManager with the given message handlers and node_id secret key
5794 * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
5795 * cryptographically secure random bytes.
5797 MUST_USE_RES LDKPeerManager PeerManager_new(LDKMessageHandler message_handler, LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], LDKLogger logger);
5800 * Get the list of node ids for peers which have completed the initial handshake.
5802 * For outbound connections, this will be the same as the their_node_id parameter passed in to
5803 * new_outbound_connection, however entries will only appear once the initial handshake has
5804 * completed and we are sure the remote peer has the private key for the given node_id.
5806 MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const LDKPeerManager *this_arg);
5809 * Indicates a new outbound connection has been established to a node with the given node_id.
5810 * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
5811 * descriptor but must disconnect the connection immediately.
5813 * Returns a small number of bytes to send to the remote node (currently always 50).
5815 * Panics if descriptor is duplicative with some other descriptor which has not yet had a
5816 * socket_disconnected().
5818 MUST_USE_RES LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const LDKPeerManager *this_arg, LDKPublicKey their_node_id, LDKSocketDescriptor descriptor);
5821 * Indicates a new inbound connection has been established.
5823 * May refuse the connection by returning an Err, but will never write bytes to the remote end
5824 * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
5825 * call socket_disconnected for the new descriptor but must disconnect the connection
5828 * Panics if descriptor is duplicative with some other descriptor which has not yet had
5829 * socket_disconnected called.
5831 MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const LDKPeerManager *this_arg, LDKSocketDescriptor descriptor);
5834 * Indicates that there is room to write data to the given socket descriptor.
5836 * May return an Err to indicate that the connection should be closed.
5838 * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
5839 * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
5840 * invariants around calling write_buffer_space_avail in case a write did not fully complete
5841 * must still hold - be ready to call write_buffer_space_avail again if a write call generated
5842 * here isn't sufficient! Panics if the descriptor was not previously registered in a
5843 * new_\\*_connection event.
5845 MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const LDKPeerManager *this_arg, LDKSocketDescriptor *descriptor);
5848 * Indicates that data was read from the given socket descriptor.
5850 * May return an Err to indicate that the connection should be closed.
5852 * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
5853 * Thus, however, you almost certainly want to call process_events() after any read_event to
5854 * generate send_data calls to handle responses.
5856 * If Ok(true) is returned, further read_events should not be triggered until a send_data call
5857 * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
5859 * Panics if the descriptor was not previously registered in a new_*_connection event.
5861 MUST_USE_RES LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const LDKPeerManager *this_arg, LDKSocketDescriptor *peer_descriptor, LDKu8slice data);
5864 * Checks for any events generated by our handlers and processes them. Includes sending most
5865 * response messages as well as messages generated by calls to handler functions directly (eg
5866 * functions like ChannelManager::process_pending_htlc_forward or send_payment).
5868 void PeerManager_process_events(const LDKPeerManager *this_arg);
5871 * Indicates that the given socket descriptor's connection is now closed.
5873 * This must only be called if the socket has been disconnected by the peer or your own
5874 * decision to disconnect it and must NOT be called in any case where other parts of this
5875 * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
5878 * Panics if the descriptor was not previously registered in a successful new_*_connection event.
5880 void PeerManager_socket_disconnected(const LDKPeerManager *this_arg, const LDKSocketDescriptor *descriptor);
5883 * This function should be called roughly once every 30 seconds.
5884 * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
5885 * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
5887 void PeerManager_timer_tick_occured(const LDKPeerManager *this_arg);
5890 * Build the commitment secret from the seed and the commitment number
5892 LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
5895 * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
5896 * from the base secret and the per_commitment_point.
5898 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
5899 * generated (ie our own).
5901 LDKCResult_SecretKeySecpErrorZ derive_private_key(LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
5904 * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
5905 * from the base point and the per_commitment_key. This is the public equivalent of
5906 * derive_private_key - using only public keys to derive a public key instead of private keys.
5908 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
5909 * generated (ie our own).
5911 LDKCResult_PublicKeySecpErrorZ derive_public_key(LDKPublicKey per_commitment_point, LDKPublicKey base_point);
5914 * Derives a per-commitment-transaction revocation key from its constituent parts.
5916 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
5917 * generated (ie our own).
5919 LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*revocation_base_secret)[32]);
5922 * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
5923 * the public equivalend of derive_private_revocation_key - using only public keys to derive a
5924 * public key instead of private keys.
5926 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
5927 * generated (ie our own).
5929 LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(LDKPublicKey per_commitment_point, LDKPublicKey revocation_base_point);
5931 void TxCreationKeys_free(LDKTxCreationKeys this_ptr);
5934 * The per-commitment public key which was used to derive the other keys.
5936 LDKPublicKey TxCreationKeys_get_per_commitment_point(const LDKTxCreationKeys *this_ptr);
5939 * The per-commitment public key which was used to derive the other keys.
5941 void TxCreationKeys_set_per_commitment_point(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
5944 * The revocation key which is used to allow the owner of the commitment transaction to
5945 * provide their counterparty the ability to punish them if they broadcast an old state.
5947 LDKPublicKey TxCreationKeys_get_revocation_key(const LDKTxCreationKeys *this_ptr);
5950 * The revocation key which is used to allow the owner of the commitment transaction to
5951 * provide their counterparty the ability to punish them if they broadcast an old state.
5953 void TxCreationKeys_set_revocation_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
5958 LDKPublicKey TxCreationKeys_get_a_htlc_key(const LDKTxCreationKeys *this_ptr);
5963 void TxCreationKeys_set_a_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
5968 LDKPublicKey TxCreationKeys_get_b_htlc_key(const LDKTxCreationKeys *this_ptr);
5973 void TxCreationKeys_set_b_htlc_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
5976 * A's Payment Key (which isn't allowed to be spent from for some delay)
5978 LDKPublicKey TxCreationKeys_get_a_delayed_payment_key(const LDKTxCreationKeys *this_ptr);
5981 * A's Payment Key (which isn't allowed to be spent from for some delay)
5983 void TxCreationKeys_set_a_delayed_payment_key(LDKTxCreationKeys *this_ptr, LDKPublicKey val);
5985 MUST_USE_RES LDKTxCreationKeys TxCreationKeys_new(LDKPublicKey per_commitment_point_arg, LDKPublicKey revocation_key_arg, LDKPublicKey a_htlc_key_arg, LDKPublicKey b_htlc_key_arg, LDKPublicKey a_delayed_payment_key_arg);
5987 LDKCVec_u8Z TxCreationKeys_write(const LDKTxCreationKeys *obj);
5989 LDKTxCreationKeys TxCreationKeys_read(LDKu8slice ser);
5991 void PreCalculatedTxCreationKeys_free(LDKPreCalculatedTxCreationKeys this_ptr);
5994 * Create a new PreCalculatedTxCreationKeys from TxCreationKeys
5996 MUST_USE_RES LDKPreCalculatedTxCreationKeys PreCalculatedTxCreationKeys_new(LDKTxCreationKeys keys);
5999 * The pre-calculated transaction creation public keys.
6000 * An external validating signer should not trust these keys.
6002 MUST_USE_RES LDKTxCreationKeys PreCalculatedTxCreationKeys_trust_key_derivation(const LDKPreCalculatedTxCreationKeys *this_arg);
6005 * The transaction per-commitment point
6007 MUST_USE_RES LDKPublicKey PreCalculatedTxCreationKeys_per_commitment_point(const LDKPreCalculatedTxCreationKeys *this_arg);
6009 void ChannelPublicKeys_free(LDKChannelPublicKeys this_ptr);
6012 * The public key which is used to sign all commitment transactions, as it appears in the
6013 * on-chain channel lock-in 2-of-2 multisig output.
6015 LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const LDKChannelPublicKeys *this_ptr);
6018 * The public key which is used to sign all commitment transactions, as it appears in the
6019 * on-chain channel lock-in 2-of-2 multisig output.
6021 void ChannelPublicKeys_set_funding_pubkey(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6024 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
6025 * revocation keys. This is combined with the per-commitment-secret generated by the
6026 * counterparty to create a secret which the counterparty can reveal to revoke previous
6029 LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const LDKChannelPublicKeys *this_ptr);
6032 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
6033 * revocation keys. This is combined with the per-commitment-secret generated by the
6034 * counterparty to create a secret which the counterparty can reveal to revoke previous
6037 void ChannelPublicKeys_set_revocation_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6040 * The public key which receives our immediately spendable primary channel balance in
6041 * remote-broadcasted commitment transactions. This key is static across every commitment
6044 LDKPublicKey ChannelPublicKeys_get_payment_point(const LDKChannelPublicKeys *this_ptr);
6047 * The public key which receives our immediately spendable primary channel balance in
6048 * remote-broadcasted commitment transactions. This key is static across every commitment
6051 void ChannelPublicKeys_set_payment_point(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6054 * The base point which is used (with derive_public_key) to derive a per-commitment payment
6055 * public key which receives non-HTLC-encumbered funds which are only available for spending
6056 * after some delay (or can be claimed via the revocation path).
6058 LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const LDKChannelPublicKeys *this_ptr);
6061 * The base point which is used (with derive_public_key) to derive a per-commitment payment
6062 * public key which receives non-HTLC-encumbered funds which are only available for spending
6063 * after some delay (or can be claimed via the revocation path).
6065 void ChannelPublicKeys_set_delayed_payment_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6068 * The base point which is used (with derive_public_key) to derive a per-commitment public key
6069 * which is used to encumber HTLC-in-flight outputs.
6071 LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const LDKChannelPublicKeys *this_ptr);
6074 * The base point which is used (with derive_public_key) to derive a per-commitment public key
6075 * which is used to encumber HTLC-in-flight outputs.
6077 void ChannelPublicKeys_set_htlc_basepoint(LDKChannelPublicKeys *this_ptr, LDKPublicKey val);
6079 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);
6081 LDKCVec_u8Z ChannelPublicKeys_write(const LDKChannelPublicKeys *obj);
6083 LDKChannelPublicKeys ChannelPublicKeys_read(LDKu8slice ser);
6086 * Create a new TxCreationKeys from channel base points and the per-commitment point
6088 MUST_USE_RES LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_derive_new(LDKPublicKey per_commitment_point, LDKPublicKey a_delayed_payment_base, LDKPublicKey a_htlc_base, LDKPublicKey b_revocation_base, LDKPublicKey b_htlc_base);
6091 * A script either spendable by the revocation
6092 * key or the delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
6093 * Encumbering a `to_local` output on a commitment transaction or 2nd-stage HTLC transactions.
6095 LDKCVec_u8Z get_revokeable_redeemscript(LDKPublicKey revocation_key, uint16_t to_self_delay, LDKPublicKey delayed_payment_key);
6097 void HTLCOutputInCommitment_free(LDKHTLCOutputInCommitment this_ptr);
6100 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
6101 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
6102 * need to compare this value to whether the commitment transaction in question is that of
6103 * the remote party or our own.
6105 bool HTLCOutputInCommitment_get_offered(const LDKHTLCOutputInCommitment *this_ptr);
6108 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
6109 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
6110 * need to compare this value to whether the commitment transaction in question is that of
6111 * the remote party or our own.
6113 void HTLCOutputInCommitment_set_offered(LDKHTLCOutputInCommitment *this_ptr, bool val);
6116 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
6117 * this divided by 1000.
6119 uint64_t HTLCOutputInCommitment_get_amount_msat(const LDKHTLCOutputInCommitment *this_ptr);
6122 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
6123 * this divided by 1000.
6125 void HTLCOutputInCommitment_set_amount_msat(LDKHTLCOutputInCommitment *this_ptr, uint64_t val);
6128 * The CLTV lock-time at which this HTLC expires.
6130 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const LDKHTLCOutputInCommitment *this_ptr);
6133 * The CLTV lock-time at which this HTLC expires.
6135 void HTLCOutputInCommitment_set_cltv_expiry(LDKHTLCOutputInCommitment *this_ptr, uint32_t val);
6138 * The hash of the preimage which unlocks this HTLC.
6140 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const LDKHTLCOutputInCommitment *this_ptr))[32];
6143 * The hash of the preimage which unlocks this HTLC.
6145 void HTLCOutputInCommitment_set_payment_hash(LDKHTLCOutputInCommitment *this_ptr, LDKThirtyTwoBytes val);
6147 LDKCVec_u8Z HTLCOutputInCommitment_write(const LDKHTLCOutputInCommitment *obj);
6149 LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(LDKu8slice ser);
6152 * note here that 'a_revocation_key' is generated using b_revocation_basepoint and a's
6153 * commitment secret. 'htlc' does *not* need to have its previous_output_index filled.
6155 LDKCVec_u8Z get_htlc_redeemscript(const LDKHTLCOutputInCommitment *htlc, const LDKTxCreationKeys *keys);
6158 * Gets the redeemscript for a funding output from the two funding public keys.
6159 * Note that the order of funding public keys does not matter.
6161 LDKCVec_u8Z make_funding_redeemscript(LDKPublicKey a, LDKPublicKey b);
6164 * panics if htlc.transaction_output_index.is_none()!
6166 LDKCVec_u8Z build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t to_self_delay, const LDKHTLCOutputInCommitment *htlc, LDKPublicKey a_delayed_payment_key, LDKPublicKey revocation_key);
6168 void LocalCommitmentTransaction_free(LDKLocalCommitmentTransaction this_ptr);
6171 * The commitment transaction itself, in unsigned form.
6173 LDKCVec_u8Z LocalCommitmentTransaction_get_unsigned_tx(const LDKLocalCommitmentTransaction *this_ptr);
6176 * The commitment transaction itself, in unsigned form.
6178 void LocalCommitmentTransaction_set_unsigned_tx(LDKLocalCommitmentTransaction *this_ptr, LDKCVec_u8Z val);
6181 * Our counterparty's signature for the transaction, above.
6183 LDKSignature LocalCommitmentTransaction_get_their_sig(const LDKLocalCommitmentTransaction *this_ptr);
6186 * Our counterparty's signature for the transaction, above.
6188 void LocalCommitmentTransaction_set_their_sig(LDKLocalCommitmentTransaction *this_ptr, LDKSignature val);
6191 * The feerate paid per 1000-weight-unit in this commitment transaction. This value is
6192 * controlled by the channel initiator.
6194 uint32_t LocalCommitmentTransaction_get_feerate_per_kw(const LDKLocalCommitmentTransaction *this_ptr);
6197 * The feerate paid per 1000-weight-unit in this commitment transaction. This value is
6198 * controlled by the channel initiator.
6200 void LocalCommitmentTransaction_set_feerate_per_kw(LDKLocalCommitmentTransaction *this_ptr, uint32_t val);
6203 * The HTLCs and remote htlc signatures which were included in this commitment transaction.
6205 * Note that this includes all HTLCs, including ones which were considered dust and not
6206 * actually included in the transaction as it appears on-chain, but who's value is burned as
6207 * fees and not included in the to_local or to_remote outputs.
6209 * The remote HTLC signatures in the second element will always be set for non-dust HTLCs, ie
6210 * those for which transaction_output_index.is_some().
6212 void LocalCommitmentTransaction_set_per_htlc(LDKLocalCommitmentTransaction *this_ptr, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val);
6215 * Generate a new LocalCommitmentTransaction based on a raw commitment transaction,
6216 * remote signature and both parties keys.
6218 * The unsigned transaction outputs must be consistent with htlc_data. This function
6219 * only checks that the shape and amounts are consistent, but does not check the scriptPubkey.
6221 MUST_USE_RES LDKLocalCommitmentTransaction LocalCommitmentTransaction_new_missing_local_sig(LDKCVec_u8Z unsigned_tx, LDKSignature their_sig, LDKPublicKey our_funding_key, LDKPublicKey their_funding_key, LDKTxCreationKeys local_keys, uint32_t feerate_per_kw, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data);
6224 * The pre-calculated transaction creation public keys.
6225 * An external validating signer should not trust these keys.
6227 MUST_USE_RES LDKTxCreationKeys LocalCommitmentTransaction_trust_key_derivation(const LDKLocalCommitmentTransaction *this_arg);
6230 * Get the txid of the local commitment transaction contained in this
6231 * LocalCommitmentTransaction
6233 MUST_USE_RES LDKThirtyTwoBytes LocalCommitmentTransaction_txid(const LDKLocalCommitmentTransaction *this_arg);
6236 * Gets our signature for the contained commitment transaction given our funding private key.
6238 * Funding key is your key included in the 2-2 funding_outpoint lock. Should be provided
6239 * by your ChannelKeys.
6240 * Funding redeemscript is script locking funding_outpoint. This is the mutlsig script
6241 * between your own funding key and your counterparty's. Currently, this is provided in
6242 * ChannelKeys::sign_local_commitment() calls directly.
6243 * Channel value is amount locked in funding_outpoint.
6245 MUST_USE_RES LDKSignature LocalCommitmentTransaction_get_local_sig(const LDKLocalCommitmentTransaction *this_arg, const uint8_t (*funding_key)[32], LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
6248 * Get a signature for each HTLC which was included in the commitment transaction (ie for
6249 * which HTLCOutputInCommitment::transaction_output_index.is_some()).
6251 * The returned Vec has one entry for each HTLC, and in the same order. For HTLCs which were
6252 * considered dust and not included, a None entry exists, for all others a signature is
6255 MUST_USE_RES LDKCResult_CVec_SignatureZNoneZ LocalCommitmentTransaction_get_htlc_sigs(const LDKLocalCommitmentTransaction *this_arg, const uint8_t (*htlc_base_key)[32], uint16_t local_csv);
6257 LDKCVec_u8Z LocalCommitmentTransaction_write(const LDKLocalCommitmentTransaction *obj);
6259 LDKLocalCommitmentTransaction LocalCommitmentTransaction_read(LDKu8slice ser);
6261 void InitFeatures_free(LDKInitFeatures this_ptr);
6263 void NodeFeatures_free(LDKNodeFeatures this_ptr);
6265 void ChannelFeatures_free(LDKChannelFeatures this_ptr);
6267 void RouteHop_free(LDKRouteHop this_ptr);
6270 * The node_id of the node at this hop.
6272 LDKPublicKey RouteHop_get_pubkey(const LDKRouteHop *this_ptr);
6275 * The node_id of the node at this hop.
6277 void RouteHop_set_pubkey(LDKRouteHop *this_ptr, LDKPublicKey val);
6280 * The channel that should be used from the previous hop to reach this node.
6282 uint64_t RouteHop_get_short_channel_id(const LDKRouteHop *this_ptr);
6285 * The channel that should be used from the previous hop to reach this node.
6287 void RouteHop_set_short_channel_id(LDKRouteHop *this_ptr, uint64_t val);
6290 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
6292 uint64_t RouteHop_get_fee_msat(const LDKRouteHop *this_ptr);
6295 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
6297 void RouteHop_set_fee_msat(LDKRouteHop *this_ptr, uint64_t val);
6300 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
6301 * expected at the destination, in excess of the current block height.
6303 uint32_t RouteHop_get_cltv_expiry_delta(const LDKRouteHop *this_ptr);
6306 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
6307 * expected at the destination, in excess of the current block height.
6309 void RouteHop_set_cltv_expiry_delta(LDKRouteHop *this_ptr, uint32_t val);
6311 void Route_free(LDKRoute this_ptr);
6314 * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
6315 * last RouteHop in each path must be the same.
6316 * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
6317 * destination. Thus, this must always be at least length one. While the maximum length of any
6318 * given path is variable, keeping the length of any path to less than 20 should currently
6319 * ensure it is viable.
6321 void Route_set_paths(LDKRoute *this_ptr, LDKCVec_CVec_RouteHopZZ val);
6323 MUST_USE_RES LDKRoute Route_new(LDKCVec_CVec_RouteHopZZ paths_arg);
6325 LDKCVec_u8Z Route_write(const LDKRoute *obj);
6327 LDKRoute Route_read(LDKu8slice ser);
6329 void RouteHint_free(LDKRouteHint this_ptr);
6332 * The node_id of the non-target end of the route
6334 LDKPublicKey RouteHint_get_src_node_id(const LDKRouteHint *this_ptr);
6337 * The node_id of the non-target end of the route
6339 void RouteHint_set_src_node_id(LDKRouteHint *this_ptr, LDKPublicKey val);
6342 * The short_channel_id of this channel
6344 uint64_t RouteHint_get_short_channel_id(const LDKRouteHint *this_ptr);
6347 * The short_channel_id of this channel
6349 void RouteHint_set_short_channel_id(LDKRouteHint *this_ptr, uint64_t val);
6352 * The fees which must be paid to use this channel
6354 LDKRoutingFees RouteHint_get_fees(const LDKRouteHint *this_ptr);
6357 * The fees which must be paid to use this channel
6359 void RouteHint_set_fees(LDKRouteHint *this_ptr, LDKRoutingFees val);
6362 * The difference in CLTV values between this node and the next node.
6364 uint16_t RouteHint_get_cltv_expiry_delta(const LDKRouteHint *this_ptr);
6367 * The difference in CLTV values between this node and the next node.
6369 void RouteHint_set_cltv_expiry_delta(LDKRouteHint *this_ptr, uint16_t val);
6372 * The minimum value, in msat, which must be relayed to the next hop.
6374 uint64_t RouteHint_get_htlc_minimum_msat(const LDKRouteHint *this_ptr);
6377 * The minimum value, in msat, which must be relayed to the next hop.
6379 void RouteHint_set_htlc_minimum_msat(LDKRouteHint *this_ptr, uint64_t val);
6381 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);
6384 * Gets a route from us to the given target node.
6386 * Extra routing hops between known nodes and the target will be used if they are included in
6389 * If some channels aren't announced, it may be useful to fill in a first_hops with the
6390 * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
6391 * view of our local channels (from net_graph_msg_handler) will be ignored, and only those in first_hops
6394 * Panics if first_hops contains channels without short_channel_ids
6395 * (ChannelManager::list_usable_channels will never include such channels).
6397 * The fees on channels from us to next-hops are ignored (as they are assumed to all be
6398 * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat
6399 * *is* checked as they may change based on the receiving node.
6401 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);
6403 void NetworkGraph_free(LDKNetworkGraph this_ptr);
6405 void LockedNetworkGraph_free(LDKLockedNetworkGraph this_ptr);
6407 void NetGraphMsgHandler_free(LDKNetGraphMsgHandler this_ptr);
6410 * Creates a new tracker of the actual state of the network of channels and nodes,
6411 * assuming a fresh network graph.
6412 * Chain monitor is used to make sure announced channels exist on-chain,
6413 * channel data is correct, and that the announcement is signed with
6414 * channel owners' keys.
6416 MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_new(LDKChainWatchInterface chain_monitor, LDKLogger logger);
6419 * Creates a new tracker of the actual state of the network of channels and nodes,
6420 * assuming an existing Network Graph.
6422 MUST_USE_RES LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(LDKChainWatchInterface chain_monitor, LDKLogger logger, LDKNetworkGraph network_graph);
6425 * Take a read lock on the network_graph and return it in the C-bindings
6426 * newtype helper. This is likely only useful when called via the C
6427 * bindings as you can call `self.network_graph.read().unwrap()` in Rust
6430 MUST_USE_RES LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const LDKNetGraphMsgHandler *this_arg);
6433 * Get a reference to the NetworkGraph which this read-lock contains.
6435 MUST_USE_RES LDKNetworkGraph LockedNetworkGraph_graph(const LDKLockedNetworkGraph *this_arg);
6437 LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const LDKNetGraphMsgHandler *this_arg);
6439 void DirectionalChannelInfo_free(LDKDirectionalChannelInfo this_ptr);
6442 * When the last update to the channel direction was issued.
6443 * Value is opaque, as set in the announcement.
6445 uint32_t DirectionalChannelInfo_get_last_update(const LDKDirectionalChannelInfo *this_ptr);
6448 * When the last update to the channel direction was issued.
6449 * Value is opaque, as set in the announcement.
6451 void DirectionalChannelInfo_set_last_update(LDKDirectionalChannelInfo *this_ptr, uint32_t val);
6454 * Whether the channel can be currently used for payments (in this one direction).
6456 bool DirectionalChannelInfo_get_enabled(const LDKDirectionalChannelInfo *this_ptr);
6459 * Whether the channel can be currently used for payments (in this one direction).
6461 void DirectionalChannelInfo_set_enabled(LDKDirectionalChannelInfo *this_ptr, bool val);
6464 * The difference in CLTV values that you must have when routing through this channel.
6466 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const LDKDirectionalChannelInfo *this_ptr);
6469 * The difference in CLTV values that you must have when routing through this channel.
6471 void DirectionalChannelInfo_set_cltv_expiry_delta(LDKDirectionalChannelInfo *this_ptr, uint16_t val);
6474 * The minimum value, which must be relayed to the next hop via the channel
6476 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const LDKDirectionalChannelInfo *this_ptr);
6479 * The minimum value, which must be relayed to the next hop via the channel
6481 void DirectionalChannelInfo_set_htlc_minimum_msat(LDKDirectionalChannelInfo *this_ptr, uint64_t val);
6484 * Most recent update for the channel received from the network
6485 * Mostly redundant with the data we store in fields explicitly.
6486 * Everything else is useful only for sending out for initial routing sync.
6487 * Not stored if contains excess data to prevent DoS.
6489 LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const LDKDirectionalChannelInfo *this_ptr);
6492 * Most recent update for the channel received from the network
6493 * Mostly redundant with the data we store in fields explicitly.
6494 * Everything else is useful only for sending out for initial routing sync.
6495 * Not stored if contains excess data to prevent DoS.
6497 void DirectionalChannelInfo_set_last_update_message(LDKDirectionalChannelInfo *this_ptr, LDKChannelUpdate val);
6499 LDKCVec_u8Z DirectionalChannelInfo_write(const LDKDirectionalChannelInfo *obj);
6501 LDKDirectionalChannelInfo DirectionalChannelInfo_read(LDKu8slice ser);
6503 void ChannelInfo_free(LDKChannelInfo this_ptr);
6506 * Source node of the first direction of a channel
6508 LDKPublicKey ChannelInfo_get_node_one(const LDKChannelInfo *this_ptr);
6511 * Source node of the first direction of a channel
6513 void ChannelInfo_set_node_one(LDKChannelInfo *this_ptr, LDKPublicKey val);
6516 * Details about the first direction of a channel
6518 LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const LDKChannelInfo *this_ptr);
6521 * Details about the first direction of a channel
6523 void ChannelInfo_set_one_to_two(LDKChannelInfo *this_ptr, LDKDirectionalChannelInfo val);
6526 * Source node of the second direction of a channel
6528 LDKPublicKey ChannelInfo_get_node_two(const LDKChannelInfo *this_ptr);
6531 * Source node of the second direction of a channel
6533 void ChannelInfo_set_node_two(LDKChannelInfo *this_ptr, LDKPublicKey val);
6536 * Details about the second direction of a channel
6538 LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const LDKChannelInfo *this_ptr);
6541 * Details about the second direction of a channel
6543 void ChannelInfo_set_two_to_one(LDKChannelInfo *this_ptr, LDKDirectionalChannelInfo val);
6546 * An initial announcement of the channel
6547 * Mostly redundant with the data we store in fields explicitly.
6548 * Everything else is useful only for sending out for initial routing sync.
6549 * Not stored if contains excess data to prevent DoS.
6551 LDKChannelAnnouncement ChannelInfo_get_announcement_message(const LDKChannelInfo *this_ptr);
6554 * An initial announcement of the channel
6555 * Mostly redundant with the data we store in fields explicitly.
6556 * Everything else is useful only for sending out for initial routing sync.
6557 * Not stored if contains excess data to prevent DoS.
6559 void ChannelInfo_set_announcement_message(LDKChannelInfo *this_ptr, LDKChannelAnnouncement val);
6561 LDKCVec_u8Z ChannelInfo_write(const LDKChannelInfo *obj);
6563 LDKChannelInfo ChannelInfo_read(LDKu8slice ser);
6565 void RoutingFees_free(LDKRoutingFees this_ptr);
6568 * Flat routing fee in satoshis
6570 uint32_t RoutingFees_get_base_msat(const LDKRoutingFees *this_ptr);
6573 * Flat routing fee in satoshis
6575 void RoutingFees_set_base_msat(LDKRoutingFees *this_ptr, uint32_t val);
6578 * Liquidity-based routing fee in millionths of a routed amount.
6579 * In other words, 10000 is 1%.
6581 uint32_t RoutingFees_get_proportional_millionths(const LDKRoutingFees *this_ptr);
6584 * Liquidity-based routing fee in millionths of a routed amount.
6585 * In other words, 10000 is 1%.
6587 void RoutingFees_set_proportional_millionths(LDKRoutingFees *this_ptr, uint32_t val);
6589 MUST_USE_RES LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
6591 LDKRoutingFees RoutingFees_read(LDKu8slice ser);
6593 LDKCVec_u8Z RoutingFees_write(const LDKRoutingFees *obj);
6595 void NodeAnnouncementInfo_free(LDKNodeAnnouncementInfo this_ptr);
6598 * When the last known update to the node state was issued.
6599 * Value is opaque, as set in the announcement.
6601 uint32_t NodeAnnouncementInfo_get_last_update(const LDKNodeAnnouncementInfo *this_ptr);
6604 * When the last known update to the node state was issued.
6605 * Value is opaque, as set in the announcement.
6607 void NodeAnnouncementInfo_set_last_update(LDKNodeAnnouncementInfo *this_ptr, uint32_t val);
6610 * Color assigned to the node
6612 const uint8_t (*NodeAnnouncementInfo_get_rgb(const LDKNodeAnnouncementInfo *this_ptr))[3];
6615 * Color assigned to the node
6617 void NodeAnnouncementInfo_set_rgb(LDKNodeAnnouncementInfo *this_ptr, LDKThreeBytes val);
6620 * Moniker assigned to the node.
6621 * May be invalid or malicious (eg control chars),
6622 * should not be exposed to the user.
6624 const uint8_t (*NodeAnnouncementInfo_get_alias(const LDKNodeAnnouncementInfo *this_ptr))[32];
6627 * Moniker assigned to the node.
6628 * May be invalid or malicious (eg control chars),
6629 * should not be exposed to the user.
6631 void NodeAnnouncementInfo_set_alias(LDKNodeAnnouncementInfo *this_ptr, LDKThirtyTwoBytes val);
6634 * Internet-level addresses via which one can connect to the node
6636 void NodeAnnouncementInfo_set_addresses(LDKNodeAnnouncementInfo *this_ptr, LDKCVec_NetAddressZ val);
6639 * An initial announcement of the node
6640 * Mostly redundant with the data we store in fields explicitly.
6641 * Everything else is useful only for sending out for initial routing sync.
6642 * Not stored if contains excess data to prevent DoS.
6644 LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const LDKNodeAnnouncementInfo *this_ptr);
6647 * An initial announcement of the node
6648 * Mostly redundant with the data we store in fields explicitly.
6649 * Everything else is useful only for sending out for initial routing sync.
6650 * Not stored if contains excess data to prevent DoS.
6652 void NodeAnnouncementInfo_set_announcement_message(LDKNodeAnnouncementInfo *this_ptr, LDKNodeAnnouncement val);
6654 LDKCVec_u8Z NodeAnnouncementInfo_write(const LDKNodeAnnouncementInfo *obj);
6656 LDKNodeAnnouncementInfo NodeAnnouncementInfo_read(LDKu8slice ser);
6658 void NodeInfo_free(LDKNodeInfo this_ptr);
6661 * All valid channels a node has announced
6663 void NodeInfo_set_channels(LDKNodeInfo *this_ptr, LDKCVec_u64Z val);
6666 * Lowest fees enabling routing via any of the enabled, known channels to a node.
6667 * The two fields (flat and proportional fee) are independent,
6668 * meaning they don't have to refer to the same channel.
6670 LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const LDKNodeInfo *this_ptr);
6673 * Lowest fees enabling routing via any of the enabled, known channels to a node.
6674 * The two fields (flat and proportional fee) are independent,
6675 * meaning they don't have to refer to the same channel.
6677 void NodeInfo_set_lowest_inbound_channel_fees(LDKNodeInfo *this_ptr, LDKRoutingFees val);
6680 * More information about a node from node_announcement.
6681 * Optional because we store a Node entry after learning about it from
6682 * a channel announcement, but before receiving a node announcement.
6684 LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const LDKNodeInfo *this_ptr);
6687 * More information about a node from node_announcement.
6688 * Optional because we store a Node entry after learning about it from
6689 * a channel announcement, but before receiving a node announcement.
6691 void NodeInfo_set_announcement_info(LDKNodeInfo *this_ptr, LDKNodeAnnouncementInfo val);
6693 MUST_USE_RES LDKNodeInfo NodeInfo_new(LDKCVec_u64Z channels_arg, LDKRoutingFees lowest_inbound_channel_fees_arg, LDKNodeAnnouncementInfo announcement_info_arg);
6695 LDKCVec_u8Z NodeInfo_write(const LDKNodeInfo *obj);
6697 LDKNodeInfo NodeInfo_read(LDKu8slice ser);
6699 LDKCVec_u8Z NetworkGraph_write(const LDKNetworkGraph *obj);
6701 LDKNetworkGraph NetworkGraph_read(LDKu8slice ser);
6704 * Creates a new, empty, network graph.
6706 MUST_USE_RES LDKNetworkGraph NetworkGraph_new(void);
6709 * Close a channel if a corresponding HTLC fail was sent.
6710 * If permanent, removes a channel from the local storage.
6711 * May cause the removal of nodes too, if this was their last channel.
6712 * If not permanent, makes channels unavailable for routing.
6714 void NetworkGraph_close_channel_from_update(LDKNetworkGraph *this_arg, uint64_t short_channel_id, bool is_permanent);
6716 /* Text to put at the end of the generated file */