1 /* Text to put at the beginning of the generated file. Probably a license. */
3 /* Generated with cbindgen:0.16.0 */
5 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
13 * An error when accessing the chain via [`Access`].
15 * [`Access`]: trait.Access.html
17 typedef enum LDKAccessError {
19 * The requested chain is unknown.
21 LDKAccessError_UnknownChain,
23 * The requested transaction doesn't exist or hasn't confirmed.
25 LDKAccessError_UnknownTx,
27 * Must be last for serialization purposes
29 LDKAccessError_Sentinel,
33 * An error enum representing a failure to persist a channel monitor update.
35 typedef enum LDKChannelMonitorUpdateErr {
37 * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
38 * our state failed, but is expected to succeed at some point in the future).
40 * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
41 * submitting new commitment transactions to the counterparty. Once the update(s) which failed
42 * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
43 * restore the channel to an operational state.
45 * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
46 * you return a TemporaryFailure you must ensure that it is written to disk safely before
47 * writing out the latest ChannelManager state.
49 * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
50 * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
51 * to claim it on this channel) and those updates must be applied wherever they can be. At
52 * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
53 * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
54 * the channel which would invalidate previous ChannelMonitors are not made when a channel has
57 * Note that even if updates made after TemporaryFailure succeed you must still call
58 * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
61 * Note that the update being processed here will not be replayed for you when you call
62 * ChannelManager::channel_monitor_updated, so you must store the update itself along
63 * with the persisted ChannelMonitor on your own local disk prior to returning a
64 * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
65 * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
68 * For deployments where a copy of ChannelMonitors and other local state are backed up in a
69 * remote location (with local copies persisted immediately), it is anticipated that all
70 * updates will return TemporaryFailure until the remote copies could be updated.
72 LDKChannelMonitorUpdateErr_TemporaryFailure,
74 * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
75 * different watchtower and cannot update with all watchtowers that were previously informed
78 * At reception of this error, ChannelManager will force-close the channel and return at
79 * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
80 * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
81 * update must be rejected.
83 * This failure may also signal a failure to update the local persisted copy of one of
84 * the channel monitor instance.
86 * Note that even when you fail a holder commitment transaction update, you must store the
87 * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
88 * broadcasts it (e.g distributed channel-monitor deployment)
90 * In case of distributed watchtowers deployment, the new version must be written to disk, as
91 * state may have been stored but rejected due to a block forcing a commitment broadcast. This
92 * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
93 * lagging behind on block processing.
95 LDKChannelMonitorUpdateErr_PermanentFailure,
97 * Must be last for serialization purposes
99 LDKChannelMonitorUpdateErr_Sentinel,
100 } LDKChannelMonitorUpdateErr;
103 * An enum that represents the speed at which we want a transaction to confirm used for feerate
106 typedef enum LDKConfirmationTarget {
108 * We are happy with this transaction confirming slowly when feerate drops some.
110 LDKConfirmationTarget_Background,
112 * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
114 LDKConfirmationTarget_Normal,
116 * We'd like this transaction to confirm in the next few blocks.
118 LDKConfirmationTarget_HighPriority,
120 * Must be last for serialization purposes
122 LDKConfirmationTarget_Sentinel,
123 } LDKConfirmationTarget;
126 * An enum representing the available verbosity levels of the logger.
128 typedef enum LDKLevel {
130 *Designates logger being silent
134 * Designates very serious errors
138 * Designates hazardous situations
142 * Designates useful information
146 * Designates lower priority information
150 * Designates very low priority, often extremely verbose, information
154 * Must be last for serialization purposes
159 typedef enum LDKNetwork {
164 * Must be last for serialization purposes
169 typedef enum LDKSecp256k1Error {
170 LDKSecp256k1Error_IncorrectSignature,
171 LDKSecp256k1Error_InvalidMessage,
172 LDKSecp256k1Error_InvalidPublicKey,
173 LDKSecp256k1Error_InvalidSignature,
174 LDKSecp256k1Error_InvalidSecretKey,
175 LDKSecp256k1Error_InvalidRecoveryId,
176 LDKSecp256k1Error_InvalidTweak,
177 LDKSecp256k1Error_NotEnoughMemory,
178 LDKSecp256k1Error_CallbackPanicked,
180 * Must be last for serialization purposes
182 LDKSecp256k1Error_Sentinel,
186 * A serialized transaction, in (pointer, length) form.
188 * This type optionally owns its own memory, and thus the semantics around access change based on
189 * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
190 * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
191 * access to the buffer after the scope in which the object was provided to you is invalid. eg,
192 * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
193 * you would be invalid.
195 * Note that, while it may change in the future, because transactions on the Rust side are stored
196 * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
197 * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
198 * `data_is_owned` either set or unset at your discretion.
200 typedef struct LDKTransaction {
202 * This is non-const for your convenience, an object passed to Rust is never written to.
209 typedef struct LDKCVecTempl_u8 {
214 typedef struct LDKCVecTempl_u8 LDKCVec_u8Z;
217 * A transaction output including a scriptPubKey and value.
218 * This type *does* own its own memory, so must be free'd appropriately.
220 typedef struct LDKTxOut {
221 LDKCVec_u8Z script_pubkey;
225 typedef struct LDKC2TupleTempl_usize__Transaction {
227 struct LDKTransaction b;
228 } LDKC2TupleTempl_usize__Transaction;
230 typedef struct LDKC2TupleTempl_usize__Transaction LDKC2Tuple_usizeTransactionZ;
232 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
234 * Note that this value is always NULL, as there are no contents in the OK variant
237 enum LDKChannelMonitorUpdateErr *err;
238 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
240 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
241 union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
243 } LDKCResult_NoneChannelMonitorUpdateErrZ;
248 * An update generated by the underlying Channel itself which contains some new information the
249 * ChannelMonitor should be made aware of.
251 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
253 * Nearly everywhere, inner must be non-null, however in places where
254 * the Rust equivalent takes an Option, it may be set to null to indicate None.
256 LDKnativeChannelMonitorUpdate *inner;
258 } LDKChannelMonitorUpdate;
263 * An error in decoding a message or struct.
265 typedef struct MUST_USE_STRUCT LDKDecodeError {
267 * Nearly everywhere, inner must be non-null, however in places where
268 * the Rust equivalent takes an Option, it may be set to null to indicate None.
270 LDKnativeDecodeError *inner;
274 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
275 struct LDKChannelMonitorUpdate *result;
276 struct LDKDecodeError *err;
277 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
279 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
280 union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
282 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
287 * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
288 * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
289 * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
291 * Contains a developer-readable error message.
293 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
295 * Nearly everywhere, inner must be non-null, however in places where
296 * the Rust equivalent takes an Option, it may be set to null to indicate None.
298 LDKnativeMonitorUpdateError *inner;
300 } LDKMonitorUpdateError;
302 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
304 * Note that this value is always NULL, as there are no contents in the OK variant
307 struct LDKMonitorUpdateError *err;
308 } LDKCResult_NoneMonitorUpdateErrorZPtr;
310 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
311 union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
313 } LDKCResult_NoneMonitorUpdateErrorZ;
318 * A reference to a transaction output.
320 * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
321 * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
323 typedef struct MUST_USE_STRUCT LDKOutPoint {
325 * Nearly everywhere, inner must be non-null, however in places where
326 * the Rust equivalent takes an Option, it may be set to null to indicate None.
328 LDKnativeOutPoint *inner;
332 typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z {
333 struct LDKOutPoint a;
335 } LDKC2TupleTempl_OutPoint__CVec_u8Z;
337 typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ;
339 typedef struct LDKC2TupleTempl_u32__TxOut {
342 } LDKC2TupleTempl_u32__TxOut;
344 typedef struct LDKC2TupleTempl_u32__TxOut LDKC2Tuple_u32TxOutZ;
347 * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
348 * look up the corresponding function in rust-lightning's docs.
350 typedef struct LDKThirtyTwoBytes {
354 typedef struct LDKCVecTempl_C2TupleTempl_u32__TxOut {
355 struct LDKC2TupleTempl_u32__TxOut *data;
357 } LDKCVecTempl_C2TupleTempl_u32__TxOut;
359 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut {
360 struct LDKThirtyTwoBytes a;
361 struct LDKCVecTempl_C2TupleTempl_u32__TxOut b;
362 } LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut;
364 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
366 typedef struct LDKCVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_u32TxOutZZ;
368 typedef struct LDKPublicKey {
369 uint8_t compressed_form[33];
375 * One counterparty's public keys which do not change over the life of a channel.
377 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
379 * Nearly everywhere, inner must be non-null, however in places where
380 * the Rust equivalent takes an Option, it may be set to null to indicate None.
382 LDKnativeChannelPublicKeys *inner;
384 } LDKChannelPublicKeys;
386 typedef struct LDKC2TupleTempl_u64__u64 {
389 } LDKC2TupleTempl_u64__u64;
391 typedef struct LDKC2TupleTempl_u64__u64 LDKC2Tuple_u64u64Z;
393 typedef struct LDKSignature {
394 uint8_t compact_form[64];
397 typedef struct LDKCVecTempl_Signature {
398 struct LDKSignature *data;
400 } LDKCVecTempl_Signature;
402 typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature {
403 struct LDKSignature a;
404 struct LDKCVecTempl_Signature b;
405 } LDKC2TupleTempl_Signature__CVecTempl_Signature;
407 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
408 struct LDKC2TupleTempl_Signature__CVecTempl_Signature *result;
410 * Note that this value is always NULL, as there are no contents in the Err variant
413 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
415 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
416 union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
418 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
423 * This class tracks the per-transaction information needed to build a commitment transaction and to
424 * actually build it and sign. It is used for holder transactions that we sign only when needed
425 * and for transactions we sign for the counterparty.
427 * This class can be used inside a signer implementation to generate a signature given the relevant
430 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
432 * Nearly everywhere, inner must be non-null, however in places where
433 * the Rust equivalent takes an Option, it may be set to null to indicate None.
435 LDKnativeCommitmentTransaction *inner;
437 } LDKCommitmentTransaction;
439 typedef union LDKCResult_SignatureNoneZPtr {
440 struct LDKSignature *result;
442 * Note that this value is always NULL, as there are no contents in the Err variant
445 } LDKCResult_SignatureNoneZPtr;
447 typedef struct LDKCResult_SignatureNoneZ {
448 union LDKCResult_SignatureNoneZPtr contents;
450 } LDKCResult_SignatureNoneZ;
455 * Information needed to build and sign a holder's commitment transaction.
457 * The transaction is only signed once we are ready to broadcast.
459 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
461 * Nearly everywhere, inner must be non-null, however in places where
462 * the Rust equivalent takes an Option, it may be set to null to indicate None.
464 LDKnativeHolderCommitmentTransaction *inner;
466 } LDKHolderCommitmentTransaction;
468 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
469 struct LDKCVecTempl_Signature *result;
471 * Note that this value is always NULL, as there are no contents in the Err variant
474 } LDKCResult_CVec_SignatureZNoneZPtr;
476 typedef struct LDKCResult_CVec_SignatureZNoneZ {
477 union LDKCResult_CVec_SignatureZNoneZPtr contents;
479 } LDKCResult_CVec_SignatureZNoneZ;
484 * Information about an HTLC as it appears in a commitment transaction
486 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
488 * Nearly everywhere, inner must be non-null, however in places where
489 * the Rust equivalent takes an Option, it may be set to null to indicate None.
491 LDKnativeHTLCOutputInCommitment *inner;
493 } LDKHTLCOutputInCommitment;
498 * The unsigned part of a channel_announcement
500 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
502 * Nearly everywhere, inner must be non-null, however in places where
503 * the Rust equivalent takes an Option, it may be set to null to indicate None.
505 LDKnativeUnsignedChannelAnnouncement *inner;
507 } LDKUnsignedChannelAnnouncement;
512 * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
513 * The fields are organized by holder/counterparty.
515 * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
516 * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
518 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
520 * Nearly everywhere, inner must be non-null, however in places where
521 * the Rust equivalent takes an Option, it may be set to null to indicate None.
523 LDKnativeChannelTransactionParameters *inner;
525 } LDKChannelTransactionParameters;
528 * Set of lightning keys needed to operate a channel as described in BOLT 3.
530 * Signing services could be implemented on a hardware wallet. In this case,
531 * the current ChannelKeys would be a front-end on top of a communication
532 * channel connected to your secure device and lightning key material wouldn't
533 * reside on a hot server. Nevertheless, a this deployment would still need
534 * to trust the ChannelManager to avoid loss of funds as this latest component
535 * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
537 * A more secure iteration would be to use hashlock (or payment points) to pair
538 * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
539 * at the price of more state and computation on the hardware wallet side. In the future,
540 * we are looking forward to design such interface.
542 * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
543 * to act, as liveness and breach reply correctness are always going to be hard requirements
544 * of LN security model, orthogonal of key management issues.
546 * If you're implementing a custom signer, you almost certainly want to implement
547 * Readable/Writable to serialize out a unique reference to this set of keys so
548 * that you can serialize the full ChannelManager object.
551 typedef struct LDKChannelKeys {
554 * Gets the per-commitment point for a specific commitment number
556 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
558 struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
560 * Gets the commitment secret for a specific commitment number as part of the revocation process
562 * An external signer implementation should error here if the commitment was already signed
563 * and should refuse to sign it in the future.
565 * May be called more than once for the same index.
567 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
568 * TODO: return a Result so we can signal a validation error
570 struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
572 * Gets the holder's channel public keys and basepoints
574 struct LDKChannelPublicKeys pubkeys;
576 * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
577 * Note that this takes a pointer to this object, not the this_ptr like other methods do
578 * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
580 void (*set_pubkeys)(const struct LDKChannelKeys*NONNULL_PTR );
582 * Gets arbitrary identifiers describing the set of keys which are provided back to you in
583 * some SpendableOutputDescriptor types. These should be sufficient to identify this
584 * ChannelKeys object uniquely and lookup or re-derive its keys.
586 LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
588 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
590 * Note that if signing fails or is rejected, the channel will be force-closed.
592 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
594 * Create a signature for a holder's commitment transaction. This will only ever be called with
595 * the same commitment_tx (or a copy thereof), though there are currently no guarantees
596 * that it will not be called multiple times.
597 * An external signer implementation should check that the commitment has not been revoked.
599 struct LDKCResult_SignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
601 * Create a signature for each HTLC transaction spending a holder's commitment transaction.
603 * Unlike sign_holder_commitment, this may be called multiple times with *different*
604 * commitment_tx values. While this will never be called with a revoked
605 * commitment_tx, it is possible that it is called with the second-latest
606 * commitment_tx (only if we haven't yet revoked it) if some watchtower/secondary
607 * ChannelMonitor decided to broadcast before it had been updated to the latest.
609 * Either an Err should be returned, or a Vec with one entry for each HTLC which exists in
612 struct LDKCResult_CVec_SignatureZNoneZ (*sign_holder_commitment_htlc_transactions)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
614 * Create a signature for the given input in a transaction spending an HTLC or commitment
615 * transaction output when our counterparty broadcasts an old state.
617 * A justice transaction may claim multiples outputs at the same time if timelocks are
618 * similar, but only a signature for the input at index `input` should be signed for here.
619 * It may be called multiples time for same output(s) if a fee-bump is needed with regards
620 * to an upcoming timelock expiration.
622 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
624 * per_commitment_key is revocation secret which was provided by our counterparty when they
625 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
626 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
629 * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
630 * changing the format of the witness script (which is committed to in the BIP 143
633 struct LDKCResult_SignatureNoneZ (*sign_justice_transaction)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
635 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
636 * transaction, either offered or received.
638 * Such a transaction may claim multiples offered outputs at same time if we know the
639 * preimage for each when we create it, but only the input at index `input` should be
640 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
641 * needed with regards to an upcoming timelock expiration.
643 * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
646 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
648 * Per_commitment_point is the dynamic point corresponding to the channel state
649 * detected onchain. It has been generated by our counterparty and is used to derive
650 * channel state keys, which are then included in the witness script and committed to in the
653 struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
655 * Create a signature for a (proposed) closing transaction.
657 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
658 * chosen to forgo their output as dust.
660 struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
662 * Signs a channel announcement message with our funding key, proving it comes from one
663 * of the channel participants.
665 * Note that if this fails or is rejected, the channel will not be publicly announced and
666 * our counterparty may (though likely will not) close the channel on us for violating the
669 struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
671 * Set the counterparty static channel data, including basepoints,
672 * counterparty_selected/holder_selected_contest_delay and funding outpoint.
673 * This is done as soon as the funding outpoint is known. Since these are static channel data,
674 * they MUST NOT be allowed to change to different values once set.
676 * channel_parameters.is_populated() MUST be true.
678 * We bind holder_selected_contest_delay late here for API convenience.
680 * Will be called before any signatures are applied.
682 void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
683 void *(*clone)(const void *this_arg);
684 LDKCVec_u8Z (*write)(const void *this_arg);
685 void (*free)(void *this_arg);
691 * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
692 * on-chain transactions to ensure no loss of funds occurs.
694 * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
695 * information and are actively monitoring the chain.
697 * Pending Events or updated HTLCs which have not yet been read out by
698 * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
699 * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
700 * gotten are fully handled before re-serializing the new state.
702 * Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which
703 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
704 * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
705 * returned block hash and the the current chain and then reconnecting blocks to get to the
706 * best chain) upon deserializing the object!
708 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
710 * Nearly everywhere, inner must be non-null, however in places where
711 * the Rust equivalent takes an Option, it may be set to null to indicate None.
713 LDKnativeChannelMonitor *inner;
717 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor {
718 struct LDKThirtyTwoBytes a;
719 struct LDKChannelMonitor b;
720 } LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor;
722 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor LDKC2Tuple_BlockHashChannelMonitorZ;
724 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
725 struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor *result;
726 struct LDKDecodeError *err;
727 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
729 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
730 union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
732 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
735 * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
736 * claim at any point in the future) an event is generated which you must track and be able to
737 * spend on-chain. The information needed to do this is provided in this enum, including the
738 * outpoint describing which txid and output index is available, the full output which exists at
739 * that txid/index, and any keys or other information required to sign.
741 typedef enum LDKSpendableOutputDescriptor_Tag {
743 * An output to a script which was provided via KeysInterface, thus you should already know
744 * how to spend it. No keys are provided as rust-lightning was never given any keys - only the
745 * script_pubkey as it appears in the output.
746 * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
747 * on-chain using the payment preimage or after it has timed out.
749 LDKSpendableOutputDescriptor_StaticOutput,
751 * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
753 * The witness in the spending input should be:
754 * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
756 * Note that the nSequence field in the spending input must be set to to_self_delay
757 * (which means the transaction is not broadcastable until at least to_self_delay
758 * blocks after the outpoint confirms).
760 * These are generally the result of a \"revocable\" output to us, spendable only by us unless
761 * it is an output from an old state which we broadcast (which should never happen).
763 * To derive the delayed_payment key which is used to sign for this input, you must pass the
764 * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
765 * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
766 * chan_utils::derive_private_key. The public key can be generated without the secret key
767 * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
768 * ChannelKeys::pubkeys().
770 * To derive the revocation_pubkey provided here (which is used in the witness
771 * script generation), you must pass the counterparty revocation_basepoint (which appears in the
772 * call to ChannelKeys::ready_channel) and the provided per_commitment point
773 * to chan_utils::derive_public_revocation_key.
775 * The witness script which is hashed and included in the output script_pubkey may be
776 * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
777 * (derived as above), and the to_self_delay contained here to
778 * chan_utils::get_revokeable_redeemscript.
780 LDKSpendableOutputDescriptor_DynamicOutputP2WSH,
782 * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
783 * corresponds to the public key in ChannelKeys::pubkeys().payment_point).
784 * The witness in the spending input, is, thus, simply:
785 * <BIP 143 signature> <payment key>
787 * These are generally the result of our counterparty having broadcast the current state,
788 * allowing us to claim the non-HTLC-encumbered outputs immediately.
790 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment,
792 * Must be last for serialization purposes
794 LDKSpendableOutputDescriptor_Sentinel,
795 } LDKSpendableOutputDescriptor_Tag;
797 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
798 struct LDKOutPoint outpoint;
799 struct LDKTxOut output;
800 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
802 typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
803 struct LDKOutPoint outpoint;
804 struct LDKPublicKey per_commitment_point;
805 uint16_t to_self_delay;
806 struct LDKTxOut output;
807 LDKC2Tuple_u64u64Z key_derivation_params;
808 struct LDKPublicKey revocation_pubkey;
809 } LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
811 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
812 struct LDKOutPoint outpoint;
813 struct LDKTxOut output;
814 LDKC2Tuple_u64u64Z key_derivation_params;
815 } LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body;
817 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
818 LDKSpendableOutputDescriptor_Tag tag;
820 LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
821 LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh;
822 LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment;
824 } LDKSpendableOutputDescriptor;
826 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
827 struct LDKSpendableOutputDescriptor *result;
828 struct LDKDecodeError *err;
829 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
831 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
832 union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
834 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
836 typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature LDKC2Tuple_SignatureCVec_SignatureZZ;
838 typedef struct LDKCVecTempl_Signature LDKCVec_SignatureZ;
840 typedef union LDKCResult_ChanKeySignerDecodeErrorZPtr {
841 struct LDKChannelKeys *result;
842 struct LDKDecodeError *err;
843 } LDKCResult_ChanKeySignerDecodeErrorZPtr;
845 typedef struct LDKCResult_ChanKeySignerDecodeErrorZ {
846 union LDKCResult_ChanKeySignerDecodeErrorZPtr contents;
848 } LDKCResult_ChanKeySignerDecodeErrorZ;
853 * A simple implementation of ChannelKeys that just keeps the private keys in memory.
855 * This implementation performs no policy checks and is insufficient by itself as
856 * a secure external signer.
858 typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
860 * Nearly everywhere, inner must be non-null, however in places where
861 * the Rust equivalent takes an Option, it may be set to null to indicate None.
863 LDKnativeInMemoryChannelKeys *inner;
865 } LDKInMemoryChannelKeys;
867 typedef union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr {
868 struct LDKInMemoryChannelKeys *result;
869 struct LDKDecodeError *err;
870 } LDKCResult_InMemoryChannelKeysDecodeErrorZPtr;
872 typedef struct LDKCResult_InMemoryChannelKeysDecodeErrorZ {
873 union LDKCResult_InMemoryChannelKeysDecodeErrorZPtr contents;
875 } LDKCResult_InMemoryChannelKeysDecodeErrorZ;
877 typedef union LDKCResult_TxOutAccessErrorZPtr {
878 struct LDKTxOut *result;
879 enum LDKAccessError *err;
880 } LDKCResult_TxOutAccessErrorZPtr;
882 typedef struct LDKCResult_TxOutAccessErrorZ {
883 union LDKCResult_TxOutAccessErrorZPtr contents;
885 } LDKCResult_TxOutAccessErrorZ;
888 * A Rust str object, ie a reference to a UTF8-valid string.
889 * This is *not* null-terminated so cannot be used directly as a C string!
891 typedef struct LDKStr {
892 const uint8_t *chars;
897 * Indicates an error on the client's part (usually some variant of attempting to use too-low or
900 typedef enum LDKAPIError_Tag {
902 * Indicates the API was wholly misused (see err for more). Cases where these can be returned
903 * are documented, but generally indicates some precondition of a function was violated.
905 LDKAPIError_APIMisuseError,
907 * Due to a high feerate, we were unable to complete the request.
908 * For example, this may be returned if the feerate implies we cannot open a channel at the
909 * requested value, but opening a larger channel would succeed.
911 LDKAPIError_FeeRateTooHigh,
913 * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
914 * too-many-hops, etc).
916 LDKAPIError_RouteError,
918 * We were unable to complete the request as the Channel required to do so is unable to
919 * complete the request (or was not found). This can take many forms, including disconnected
920 * peer, channel at capacity, channel shutting down, etc.
922 LDKAPIError_ChannelUnavailable,
924 * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
925 * attempted action to fail.
927 LDKAPIError_MonitorUpdateFailed,
929 * Must be last for serialization purposes
931 LDKAPIError_Sentinel,
934 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
936 } LDKAPIError_LDKAPIMisuseError_Body;
938 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
941 } LDKAPIError_LDKFeeRateTooHigh_Body;
943 typedef struct LDKAPIError_LDKRouteError_Body {
945 } LDKAPIError_LDKRouteError_Body;
947 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
949 } LDKAPIError_LDKChannelUnavailable_Body;
951 typedef struct MUST_USE_STRUCT LDKAPIError {
954 LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
955 LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
956 LDKAPIError_LDKRouteError_Body route_error;
957 LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
961 typedef union LDKCResult_NoneAPIErrorZPtr {
963 * Note that this value is always NULL, as there are no contents in the OK variant
966 struct LDKAPIError *err;
967 } LDKCResult_NoneAPIErrorZPtr;
969 typedef struct LDKCResult_NoneAPIErrorZ {
970 union LDKCResult_NoneAPIErrorZPtr contents;
972 } LDKCResult_NoneAPIErrorZ;
977 * If a payment fails to send, it can be in one of several states. This enum is returned as the
978 * Err() type describing which state the payment is in, see the description of individual enum
981 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
983 * Nearly everywhere, inner must be non-null, however in places where
984 * the Rust equivalent takes an Option, it may be set to null to indicate None.
986 LDKnativePaymentSendFailure *inner;
988 } LDKPaymentSendFailure;
990 typedef union LDKCResult_NonePaymentSendFailureZPtr {
992 * Note that this value is always NULL, as there are no contents in the OK variant
995 struct LDKPaymentSendFailure *err;
996 } LDKCResult_NonePaymentSendFailureZPtr;
998 typedef struct LDKCResult_NonePaymentSendFailureZ {
999 union LDKCResult_NonePaymentSendFailureZPtr contents;
1001 } LDKCResult_NonePaymentSendFailureZ;
1006 * An event to be processed by the ChannelManager.
1008 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1010 * Nearly everywhere, inner must be non-null, however in places where
1011 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1013 LDKnativeMonitorEvent *inner;
1017 typedef struct LDKCVecTempl_MonitorEvent {
1018 struct LDKMonitorEvent *data;
1020 } LDKCVecTempl_MonitorEvent;
1022 typedef struct LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ;
1025 * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
1026 * blocks are connected and disconnected.
1028 * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
1029 * responsible for maintaining a set of monitors such that they can be updated accordingly as
1030 * channel state changes and HTLCs are resolved. See method documentation for specific
1033 * Implementations **must** ensure that updates are successfully applied and persisted upon method
1034 * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
1035 * without taking any further action such as persisting the current state.
1037 * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
1038 * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
1039 * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
1040 * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
1041 * multiple instances.
1043 * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
1044 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1045 * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
1047 typedef struct LDKWatch {
1050 * Watches a channel identified by `funding_txo` using `monitor`.
1052 * Implementations are responsible for watching the chain for the funding transaction along
1053 * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
1054 * calling [`block_connected`] and [`block_disconnected`] on the monitor.
1056 * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
1057 * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
1058 * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
1060 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
1062 * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
1064 * Implementations must call [`update_monitor`] with the given update. See
1065 * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
1067 * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
1068 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
1070 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
1072 * Returns any monitor events since the last call. Subsequent calls must only return new
1075 LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
1076 void (*free)(void *this_arg);
1080 * An interface to send a transaction to the Bitcoin network.
1082 typedef struct LDKBroadcasterInterface {
1085 * Sends a transaction out to (hopefully) be mined.
1087 void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
1088 void (*free)(void *this_arg);
1089 } LDKBroadcasterInterface;
1091 typedef struct LDKSecretKey {
1095 typedef struct LDKu8slice {
1096 const uint8_t *data;
1101 * A trait to describe an object which can get user secrets and key material.
1103 typedef struct LDKKeysInterface {
1106 * Get node secret key (aka node_id or network_key)
1108 struct LDKSecretKey (*get_node_secret)(const void *this_arg);
1110 * Get destination redeemScript to encumber static protocol exit points.
1112 LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
1114 * Get shutdown_pubkey to use as PublicKey at channel closure
1116 struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
1118 * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
1119 * restarted with some stale data!
1121 struct LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
1123 * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
1124 * onion packets and for temporary channel IDs. There is no requirement that these be
1125 * persisted anywhere, though they must be unique across restarts.
1127 struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
1129 * Reads a `ChanKeySigner` for this `KeysInterface` from the given input stream.
1130 * This is only called during deserialization of other objects which contain
1131 * `ChannelKeys`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
1132 * The bytes are exactly those which `<Self::ChanKeySigner as Writeable>::write()` writes, and
1133 * contain no versioning scheme. You may wish to include your own version prefix and ensure
1134 * you've read all of the provided bytes to ensure no corruption occurred.
1136 struct LDKCResult_ChanKeySignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
1137 void (*free)(void *this_arg);
1141 * A trait which should be implemented to provide feerate information on a number of time
1144 * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
1145 * called from inside the library in response to chain events, P2P events, or timer events).
1147 typedef struct LDKFeeEstimator {
1150 * Gets estimated satoshis of fee required per 1000 Weight-Units.
1152 * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
1153 * don't put us below 1 satoshi-per-byte).
1155 * This translates to:
1156 * * satoshis-per-byte * 250
1157 * * ceil(satoshis-per-kbyte / 4)
1159 uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
1160 void (*free)(void *this_arg);
1164 * A trait encapsulating the operations required of a logger
1166 typedef struct LDKLogger {
1171 void (*log)(const void *this_arg, const char *record);
1172 void (*free)(void *this_arg);
1178 * Manager which keeps track of a number of channels and sends messages to the appropriate
1179 * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
1181 * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
1182 * to individual Channels.
1184 * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
1185 * all peers during write/read (though does not modify this instance, only the instance being
1186 * serialized). This will result in any channels which have not yet exchanged funding_created (ie
1187 * called funding_transaction_generated for outbound channels).
1189 * Note that you can be a bit lazier about writing out ChannelManager than you can be with
1190 * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
1191 * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
1192 * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
1193 * the serialization process). If the deserialized version is out-of-date compared to the
1194 * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
1195 * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
1197 * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which
1198 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
1199 * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
1200 * block_connected() to step towards your best block) upon deserialization before using the
1203 * Note that ChannelManager is responsible for tracking liveness of its channels and generating
1204 * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
1205 * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
1206 * offline for a full minute. In order to track this, you must call
1207 * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect.
1209 * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
1210 * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
1211 * essentially you should default to using a SimpleRefChannelManager, and use a
1212 * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
1213 * you're using lightning-net-tokio.
1215 typedef struct MUST_USE_STRUCT LDKChannelManager {
1217 * Nearly everywhere, inner must be non-null, however in places where
1218 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1220 LDKnativeChannelManager *inner;
1222 } LDKChannelManager;
1224 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager {
1225 struct LDKThirtyTwoBytes a;
1226 struct LDKChannelManager b;
1227 } LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager;
1229 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager LDKC2Tuple_BlockHashChannelManagerZ;
1231 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
1232 struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager *result;
1233 struct LDKDecodeError *err;
1234 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
1236 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
1237 union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
1239 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
1241 typedef struct LDKFourBytes {
1245 typedef struct LDKSixteenBytes {
1249 typedef struct LDKTenBytes {
1254 * An address which can be used to connect to a remote peer
1256 typedef enum LDKNetAddress_Tag {
1258 * An IPv4 address/port on which the peer is listening.
1262 * An IPv6 address/port on which the peer is listening.
1266 * An old-style Tor onion address/port on which the peer is listening.
1268 LDKNetAddress_OnionV2,
1270 * A new-style Tor onion address/port on which the peer is listening.
1271 * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
1272 * wrap as base32 and append \".onion\".
1274 LDKNetAddress_OnionV3,
1276 * Must be last for serialization purposes
1278 LDKNetAddress_Sentinel,
1279 } LDKNetAddress_Tag;
1281 typedef struct LDKNetAddress_LDKIPv4_Body {
1282 struct LDKFourBytes addr;
1284 } LDKNetAddress_LDKIPv4_Body;
1286 typedef struct LDKNetAddress_LDKIPv6_Body {
1287 struct LDKSixteenBytes addr;
1289 } LDKNetAddress_LDKIPv6_Body;
1291 typedef struct LDKNetAddress_LDKOnionV2_Body {
1292 struct LDKTenBytes addr;
1294 } LDKNetAddress_LDKOnionV2_Body;
1296 typedef struct LDKNetAddress_LDKOnionV3_Body {
1297 struct LDKThirtyTwoBytes ed25519_pubkey;
1301 } LDKNetAddress_LDKOnionV3_Body;
1303 typedef struct MUST_USE_STRUCT LDKNetAddress {
1304 LDKNetAddress_Tag tag;
1306 LDKNetAddress_LDKIPv4_Body i_pv4;
1307 LDKNetAddress_LDKIPv6_Body i_pv6;
1308 LDKNetAddress_LDKOnionV2_Body onion_v2;
1309 LDKNetAddress_LDKOnionV3_Body onion_v3;
1313 typedef union LDKCResult_NetAddressu8ZPtr {
1314 struct LDKNetAddress *result;
1316 } LDKCResult_NetAddressu8ZPtr;
1318 typedef struct LDKCResult_NetAddressu8Z {
1319 union LDKCResult_NetAddressu8ZPtr contents;
1321 } LDKCResult_NetAddressu8Z;
1323 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
1324 struct LDKCResult_NetAddressu8Z *result;
1325 struct LDKDecodeError *err;
1326 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
1328 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
1329 union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
1331 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
1336 * An Err type for failure to process messages.
1338 typedef struct MUST_USE_STRUCT LDKLightningError {
1340 * Nearly everywhere, inner must be non-null, however in places where
1341 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1343 LDKnativeLightningError *inner;
1345 } LDKLightningError;
1347 typedef union LDKCResult_boolLightningErrorZPtr {
1349 struct LDKLightningError *err;
1350 } LDKCResult_boolLightningErrorZPtr;
1352 typedef struct LDKCResult_boolLightningErrorZ {
1353 union LDKCResult_boolLightningErrorZPtr contents;
1355 } LDKCResult_boolLightningErrorZ;
1360 * A channel_announcement message to be sent or received from a peer
1362 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
1364 * Nearly everywhere, inner must be non-null, however in places where
1365 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1367 LDKnativeChannelAnnouncement *inner;
1369 } LDKChannelAnnouncement;
1374 * A channel_update message to be sent or received from a peer
1376 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
1378 * Nearly everywhere, inner must be non-null, however in places where
1379 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1381 LDKnativeChannelUpdate *inner;
1385 typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
1386 struct LDKChannelAnnouncement a;
1387 struct LDKChannelUpdate b;
1388 struct LDKChannelUpdate c;
1389 } LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
1391 typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
1393 typedef union LDKCResult_NoneLightningErrorZPtr {
1395 * Note that this value is always NULL, as there are no contents in the OK variant
1398 struct LDKLightningError *err;
1399 } LDKCResult_NoneLightningErrorZPtr;
1401 typedef struct LDKCResult_NoneLightningErrorZ {
1402 union LDKCResult_NoneLightningErrorZPtr contents;
1404 } LDKCResult_NoneLightningErrorZ;
1409 * A channel_reestablish message to be sent or received from a peer
1411 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
1413 * Nearly everywhere, inner must be non-null, however in places where
1414 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1416 LDKnativeChannelReestablish *inner;
1418 } LDKChannelReestablish;
1420 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
1421 struct LDKChannelReestablish *result;
1422 struct LDKDecodeError *err;
1423 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
1425 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
1426 union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
1428 } LDKCResult_ChannelReestablishDecodeErrorZ;
1433 * An init message to be sent or received from a peer
1435 typedef struct MUST_USE_STRUCT LDKInit {
1437 * Nearly everywhere, inner must be non-null, however in places where
1438 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1440 LDKnativeInit *inner;
1444 typedef union LDKCResult_InitDecodeErrorZPtr {
1445 struct LDKInit *result;
1446 struct LDKDecodeError *err;
1447 } LDKCResult_InitDecodeErrorZPtr;
1449 typedef struct LDKCResult_InitDecodeErrorZ {
1450 union LDKCResult_InitDecodeErrorZPtr contents;
1452 } LDKCResult_InitDecodeErrorZ;
1457 * A ping message to be sent or received from a peer
1459 typedef struct MUST_USE_STRUCT LDKPing {
1461 * Nearly everywhere, inner must be non-null, however in places where
1462 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1464 LDKnativePing *inner;
1468 typedef union LDKCResult_PingDecodeErrorZPtr {
1469 struct LDKPing *result;
1470 struct LDKDecodeError *err;
1471 } LDKCResult_PingDecodeErrorZPtr;
1473 typedef struct LDKCResult_PingDecodeErrorZ {
1474 union LDKCResult_PingDecodeErrorZPtr contents;
1476 } LDKCResult_PingDecodeErrorZ;
1481 * A pong message to be sent or received from a peer
1483 typedef struct MUST_USE_STRUCT LDKPong {
1485 * Nearly everywhere, inner must be non-null, however in places where
1486 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1488 LDKnativePong *inner;
1492 typedef union LDKCResult_PongDecodeErrorZPtr {
1493 struct LDKPong *result;
1494 struct LDKDecodeError *err;
1495 } LDKCResult_PongDecodeErrorZPtr;
1497 typedef struct LDKCResult_PongDecodeErrorZ {
1498 union LDKCResult_PongDecodeErrorZPtr contents;
1500 } LDKCResult_PongDecodeErrorZ;
1502 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
1503 struct LDKUnsignedChannelAnnouncement *result;
1504 struct LDKDecodeError *err;
1505 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
1507 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
1508 union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
1510 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
1515 * The unsigned part of a channel_update
1517 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
1519 * Nearly everywhere, inner must be non-null, however in places where
1520 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1522 LDKnativeUnsignedChannelUpdate *inner;
1524 } LDKUnsignedChannelUpdate;
1526 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
1527 struct LDKUnsignedChannelUpdate *result;
1528 struct LDKDecodeError *err;
1529 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
1531 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
1532 union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
1534 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
1539 * An error message to be sent or received from a peer
1541 typedef struct MUST_USE_STRUCT LDKErrorMessage {
1543 * Nearly everywhere, inner must be non-null, however in places where
1544 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1546 LDKnativeErrorMessage *inner;
1550 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
1551 struct LDKErrorMessage *result;
1552 struct LDKDecodeError *err;
1553 } LDKCResult_ErrorMessageDecodeErrorZPtr;
1555 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
1556 union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
1558 } LDKCResult_ErrorMessageDecodeErrorZ;
1563 * The unsigned part of a node_announcement
1565 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
1567 * Nearly everywhere, inner must be non-null, however in places where
1568 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1570 LDKnativeUnsignedNodeAnnouncement *inner;
1572 } LDKUnsignedNodeAnnouncement;
1574 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
1575 struct LDKUnsignedNodeAnnouncement *result;
1576 struct LDKDecodeError *err;
1577 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
1579 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
1580 union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
1582 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
1587 * A query_short_channel_ids message is used to query a peer for
1588 * routing gossip messages related to one or more short_channel_ids.
1589 * The query recipient will reply with the latest, if available,
1590 * channel_announcement, channel_update and node_announcement messages
1591 * it maintains for the requested short_channel_ids followed by a
1592 * reply_short_channel_ids_end message. The short_channel_ids sent in
1593 * this query are encoded. We only support encoding_type=0 uncompressed
1594 * serialization and do not support encoding_type=1 zlib serialization.
1596 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
1598 * Nearly everywhere, inner must be non-null, however in places where
1599 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1601 LDKnativeQueryShortChannelIds *inner;
1603 } LDKQueryShortChannelIds;
1605 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
1606 struct LDKQueryShortChannelIds *result;
1607 struct LDKDecodeError *err;
1608 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
1610 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
1611 union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
1613 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
1618 * A reply_short_channel_ids_end message is sent as a reply to a
1619 * query_short_channel_ids message. The query recipient makes a best
1620 * effort to respond based on their local network view which may not be
1621 * a perfect view of the network.
1623 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
1625 * Nearly everywhere, inner must be non-null, however in places where
1626 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1628 LDKnativeReplyShortChannelIdsEnd *inner;
1630 } LDKReplyShortChannelIdsEnd;
1632 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
1633 struct LDKReplyShortChannelIdsEnd *result;
1634 struct LDKDecodeError *err;
1635 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
1637 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
1638 union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
1640 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
1645 * A query_channel_range message is used to query a peer for channel
1646 * UTXOs in a range of blocks. The recipient of a query makes a best
1647 * effort to reply to the query using one or more reply_channel_range
1650 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
1652 * Nearly everywhere, inner must be non-null, however in places where
1653 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1655 LDKnativeQueryChannelRange *inner;
1657 } LDKQueryChannelRange;
1659 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
1660 struct LDKQueryChannelRange *result;
1661 struct LDKDecodeError *err;
1662 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
1664 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
1665 union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
1667 } LDKCResult_QueryChannelRangeDecodeErrorZ;
1672 * A reply_channel_range message is a reply to a query_channel_range
1673 * message. Multiple reply_channel_range messages can be sent in reply
1674 * to a single query_channel_range message. The query recipient makes a
1675 * best effort to respond based on their local network view which may
1676 * not be a perfect view of the network. The short_channel_ids in the
1677 * reply are encoded. We only support encoding_type=0 uncompressed
1678 * serialization and do not support encoding_type=1 zlib serialization.
1680 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
1682 * Nearly everywhere, inner must be non-null, however in places where
1683 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1685 LDKnativeReplyChannelRange *inner;
1687 } LDKReplyChannelRange;
1689 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
1690 struct LDKReplyChannelRange *result;
1691 struct LDKDecodeError *err;
1692 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
1694 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
1695 union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
1697 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
1702 * A gossip_timestamp_filter message is used by a node to request
1703 * gossip relay for messages in the requested time range when the
1704 * gossip_queries feature has been negotiated.
1706 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
1708 * Nearly everywhere, inner must be non-null, however in places where
1709 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1711 LDKnativeGossipTimestampFilter *inner;
1713 } LDKGossipTimestampFilter;
1715 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
1716 struct LDKGossipTimestampFilter *result;
1717 struct LDKDecodeError *err;
1718 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
1720 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
1721 union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
1723 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
1728 * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
1729 * generate no further read_event/write_buffer_space_avail calls for the descriptor, only
1730 * triggering a single socket_disconnected call (unless it was provided in response to a
1731 * new_*_connection event, in which case no such socket_disconnected() must be called and the
1732 * socket silently disconencted).
1734 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
1736 * Nearly everywhere, inner must be non-null, however in places where
1737 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1739 LDKnativePeerHandleError *inner;
1741 } LDKPeerHandleError;
1743 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
1744 struct LDKCVecTempl_u8 *result;
1745 struct LDKPeerHandleError *err;
1746 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
1748 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
1749 union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
1751 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
1753 typedef union LDKCResult_NonePeerHandleErrorZPtr {
1755 * Note that this value is always NULL, as there are no contents in the OK variant
1758 struct LDKPeerHandleError *err;
1759 } LDKCResult_NonePeerHandleErrorZPtr;
1761 typedef struct LDKCResult_NonePeerHandleErrorZ {
1762 union LDKCResult_NonePeerHandleErrorZPtr contents;
1764 } LDKCResult_NonePeerHandleErrorZ;
1766 typedef union LDKCResult_boolPeerHandleErrorZPtr {
1768 struct LDKPeerHandleError *err;
1769 } LDKCResult_boolPeerHandleErrorZPtr;
1771 typedef struct LDKCResult_boolPeerHandleErrorZ {
1772 union LDKCResult_boolPeerHandleErrorZPtr contents;
1774 } LDKCResult_boolPeerHandleErrorZ;
1776 typedef union LDKCResult_SecretKeySecpErrorZPtr {
1777 struct LDKSecretKey *result;
1778 enum LDKSecp256k1Error *err;
1779 } LDKCResult_SecretKeySecpErrorZPtr;
1781 typedef struct LDKCResult_SecretKeySecpErrorZ {
1782 union LDKCResult_SecretKeySecpErrorZPtr contents;
1784 } LDKCResult_SecretKeySecpErrorZ;
1786 typedef union LDKCResult_PublicKeySecpErrorZPtr {
1787 struct LDKPublicKey *result;
1788 enum LDKSecp256k1Error *err;
1789 } LDKCResult_PublicKeySecpErrorZPtr;
1791 typedef struct LDKCResult_PublicKeySecpErrorZ {
1792 union LDKCResult_PublicKeySecpErrorZPtr contents;
1794 } LDKCResult_PublicKeySecpErrorZ;
1799 * The set of public keys which are used in the creation of one commitment transaction.
1800 * These are derived from the channel base keys and per-commitment data.
1802 * A broadcaster key is provided from potential broadcaster of the computed transaction.
1803 * A countersignatory key is coming from a protocol participant unable to broadcast the
1806 * These keys are assumed to be good, either because the code derived them from
1807 * channel basepoints via the new function, or they were obtained via
1808 * CommitmentTransaction.trust().keys() because we trusted the source of the
1809 * pre-calculated keys.
1811 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
1813 * Nearly everywhere, 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 LDKnativeTxCreationKeys *inner;
1818 } LDKTxCreationKeys;
1820 typedef union LDKCResult_TxCreationKeysSecpErrorZPtr {
1821 struct LDKTxCreationKeys *result;
1822 enum LDKSecp256k1Error *err;
1823 } LDKCResult_TxCreationKeysSecpErrorZPtr;
1825 typedef struct LDKCResult_TxCreationKeysSecpErrorZ {
1826 union LDKCResult_TxCreationKeysSecpErrorZPtr contents;
1828 } LDKCResult_TxCreationKeysSecpErrorZ;
1833 * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1834 * transaction and the transaction creation keys) are trusted.
1836 * See trust() and verify() functions on CommitmentTransaction.
1838 * This structure implements Deref.
1840 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1842 * Nearly everywhere, inner must be non-null, however in places where
1843 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1845 LDKnativeTrustedCommitmentTransaction *inner;
1847 } LDKTrustedCommitmentTransaction;
1849 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1850 struct LDKTrustedCommitmentTransaction *result;
1852 * Note that this value is always NULL, as there are no contents in the Err variant
1855 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1857 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1858 union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1860 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1865 * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1866 * it can take multiple paths. Each path is composed of one or more hops through the network.
1868 typedef struct MUST_USE_STRUCT LDKRoute {
1870 * Nearly everywhere, inner must be non-null, however in places where
1871 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1873 LDKnativeRoute *inner;
1877 typedef union LDKCResult_RouteDecodeErrorZPtr {
1878 struct LDKRoute *result;
1879 struct LDKDecodeError *err;
1880 } LDKCResult_RouteDecodeErrorZPtr;
1882 typedef struct LDKCResult_RouteDecodeErrorZ {
1883 union LDKCResult_RouteDecodeErrorZPtr contents;
1885 } LDKCResult_RouteDecodeErrorZ;
1887 typedef union LDKCResult_RouteLightningErrorZPtr {
1888 struct LDKRoute *result;
1889 struct LDKLightningError *err;
1890 } LDKCResult_RouteLightningErrorZPtr;
1892 typedef struct LDKCResult_RouteLightningErrorZ {
1893 union LDKCResult_RouteLightningErrorZPtr contents;
1895 } LDKCResult_RouteLightningErrorZ;
1900 * Fees for routing via a given channel or a node
1902 typedef struct MUST_USE_STRUCT LDKRoutingFees {
1904 * Nearly everywhere, inner must be non-null, however in places where
1905 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1907 LDKnativeRoutingFees *inner;
1911 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
1912 struct LDKRoutingFees *result;
1913 struct LDKDecodeError *err;
1914 } LDKCResult_RoutingFeesDecodeErrorZPtr;
1916 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
1917 union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
1919 } LDKCResult_RoutingFeesDecodeErrorZ;
1924 * Information received in the latest node_announcement from this node.
1926 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
1928 * Nearly everywhere, inner must be non-null, however in places where
1929 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1931 LDKnativeNodeAnnouncementInfo *inner;
1933 } LDKNodeAnnouncementInfo;
1935 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
1936 struct LDKNodeAnnouncementInfo *result;
1937 struct LDKDecodeError *err;
1938 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
1940 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
1941 union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
1943 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
1948 * Details about a node in the network, known from the network announcement.
1950 typedef struct MUST_USE_STRUCT LDKNodeInfo {
1952 * Nearly everywhere, inner must be non-null, however in places where
1953 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1955 LDKnativeNodeInfo *inner;
1959 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
1960 struct LDKNodeInfo *result;
1961 struct LDKDecodeError *err;
1962 } LDKCResult_NodeInfoDecodeErrorZPtr;
1964 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
1965 union LDKCResult_NodeInfoDecodeErrorZPtr contents;
1967 } LDKCResult_NodeInfoDecodeErrorZ;
1972 * Represents the network as nodes and channels between them
1974 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
1976 * Nearly everywhere, inner must be non-null, however in places where
1977 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1979 LDKnativeNetworkGraph *inner;
1983 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
1984 struct LDKNetworkGraph *result;
1985 struct LDKDecodeError *err;
1986 } LDKCResult_NetworkGraphDecodeErrorZPtr;
1988 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
1989 union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
1991 } LDKCResult_NetworkGraphDecodeErrorZ;
1993 typedef struct LDKCVecTempl_SpendableOutputDescriptor {
1994 struct LDKSpendableOutputDescriptor *data;
1996 } LDKCVecTempl_SpendableOutputDescriptor;
1998 typedef struct LDKCVecTempl_SpendableOutputDescriptor LDKCVec_SpendableOutputDescriptorZ;
2001 * An Event which you should probably take some action in response to.
2003 * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2004 * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2005 * written as it makes no sense to respond to it after reconnecting to peers).
2007 typedef enum LDKEvent_Tag {
2009 * Used to indicate that the client should generate a funding transaction with the given
2010 * parameters and then call ChannelManager::funding_transaction_generated.
2011 * Generated in ChannelManager message handling.
2012 * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2013 * counterparty can steal your funds!
2015 LDKEvent_FundingGenerationReady,
2017 * Used to indicate that the client may now broadcast the funding transaction it created for a
2018 * channel. Broadcasting such a transaction prior to this event may lead to our counterparty
2019 * trivially stealing all funds in the funding transaction!
2021 LDKEvent_FundingBroadcastSafe,
2023 * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
2024 * ChannelManager::claim_funds to get it....
2025 * Note that if the preimage is not known or the amount paid is incorrect, you should call
2026 * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
2027 * network congestion.
2028 * The amount paid should be considered 'incorrect' when it is less than or more than twice
2029 * the amount expected.
2030 * If you fail to call either ChannelManager::claim_funds or
2031 * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
2032 * automatically failed.
2034 LDKEvent_PaymentReceived,
2036 * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
2037 * and we got back the payment preimage for it).
2038 * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
2039 * deduplicate them by payment_preimage (which MUST be unique)!
2041 LDKEvent_PaymentSent,
2043 * Indicates an outbound payment we made failed. Probably some intermediary node dropped
2044 * something. You may wish to retry with a different route.
2045 * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
2046 * deduplicate them by payment_hash (which MUST be unique)!
2048 LDKEvent_PaymentFailed,
2050 * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
2051 * time in the future.
2053 LDKEvent_PendingHTLCsForwardable,
2055 * Used to indicate that an output was generated on-chain which you should know how to spend.
2056 * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2057 * counterparty spending them due to some kind of timeout. Thus, you need to store them
2058 * somewhere and spend them when you create on-chain transactions.
2060 LDKEvent_SpendableOutputs,
2062 * Must be last for serialization purposes
2067 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2068 struct LDKThirtyTwoBytes temporary_channel_id;
2069 uint64_t channel_value_satoshis;
2070 LDKCVec_u8Z output_script;
2071 uint64_t user_channel_id;
2072 } LDKEvent_LDKFundingGenerationReady_Body;
2074 typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
2075 struct LDKOutPoint funding_txo;
2076 uint64_t user_channel_id;
2077 } LDKEvent_LDKFundingBroadcastSafe_Body;
2079 typedef struct LDKEvent_LDKPaymentReceived_Body {
2080 struct LDKThirtyTwoBytes payment_hash;
2081 struct LDKThirtyTwoBytes payment_secret;
2083 } LDKEvent_LDKPaymentReceived_Body;
2085 typedef struct LDKEvent_LDKPaymentSent_Body {
2086 struct LDKThirtyTwoBytes payment_preimage;
2087 } LDKEvent_LDKPaymentSent_Body;
2089 typedef struct LDKEvent_LDKPaymentFailed_Body {
2090 struct LDKThirtyTwoBytes payment_hash;
2091 bool rejected_by_dest;
2092 } LDKEvent_LDKPaymentFailed_Body;
2094 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
2095 uint64_t time_forwardable;
2096 } LDKEvent_LDKPendingHTLCsForwardable_Body;
2098 typedef struct LDKEvent_LDKSpendableOutputs_Body {
2099 LDKCVec_SpendableOutputDescriptorZ outputs;
2100 } LDKEvent_LDKSpendableOutputs_Body;
2102 typedef struct MUST_USE_STRUCT LDKEvent {
2105 LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
2106 LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe;
2107 LDKEvent_LDKPaymentReceived_Body payment_received;
2108 LDKEvent_LDKPaymentSent_Body payment_sent;
2109 LDKEvent_LDKPaymentFailed_Body payment_failed;
2110 LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
2111 LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
2118 * An accept_channel message to be sent or received from a peer
2120 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
2122 * Nearly everywhere, inner must be non-null, however in places where
2123 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2125 LDKnativeAcceptChannel *inner;
2132 * An open_channel message to be sent or received from a peer
2134 typedef struct MUST_USE_STRUCT LDKOpenChannel {
2136 * Nearly everywhere, inner must be non-null, however in places where
2137 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2139 LDKnativeOpenChannel *inner;
2146 * A funding_created message to be sent or received from a peer
2148 typedef struct MUST_USE_STRUCT LDKFundingCreated {
2150 * Nearly everywhere, inner must be non-null, however in places where
2151 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2153 LDKnativeFundingCreated *inner;
2155 } LDKFundingCreated;
2160 * A funding_signed message to be sent or received from a peer
2162 typedef struct MUST_USE_STRUCT LDKFundingSigned {
2164 * Nearly everywhere, inner must be non-null, however in places where
2165 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2167 LDKnativeFundingSigned *inner;
2174 * A funding_locked message to be sent or received from a peer
2176 typedef struct MUST_USE_STRUCT LDKFundingLocked {
2178 * Nearly everywhere, inner must be non-null, however in places where
2179 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2181 LDKnativeFundingLocked *inner;
2188 * An announcement_signatures message to be sent or received from a peer
2190 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
2192 * Nearly everywhere, inner must be non-null, however in places where
2193 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2195 LDKnativeAnnouncementSignatures *inner;
2197 } LDKAnnouncementSignatures;
2202 * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
2203 * transaction updates if they were pending.
2205 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
2207 * Nearly everywhere, inner must be non-null, however in places where
2208 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2210 LDKnativeCommitmentUpdate *inner;
2212 } LDKCommitmentUpdate;
2217 * A revoke_and_ack message to be sent or received from a peer
2219 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
2221 * Nearly everywhere, inner must be non-null, however in places where
2222 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2224 LDKnativeRevokeAndACK *inner;
2231 * A closing_signed message to be sent or received from a peer
2233 typedef struct MUST_USE_STRUCT LDKClosingSigned {
2235 * Nearly everywhere, inner must be non-null, however in places where
2236 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2238 LDKnativeClosingSigned *inner;
2245 * A shutdown message to be sent or received from a peer
2247 typedef struct MUST_USE_STRUCT LDKShutdown {
2249 * Nearly everywhere, inner must be non-null, however in places where
2250 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2252 LDKnativeShutdown *inner;
2259 * A node_announcement message to be sent or received from a peer
2261 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
2263 * Nearly everywhere, inner must be non-null, however in places where
2264 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2266 LDKnativeNodeAnnouncement *inner;
2268 } LDKNodeAnnouncement;
2271 * Used to put an error message in a LightningError
2273 typedef enum LDKErrorAction_Tag {
2275 * The peer took some action which made us think they were useless. Disconnect them.
2277 LDKErrorAction_DisconnectPeer,
2279 * The peer did something harmless that we weren't able to process, just log and ignore
2281 LDKErrorAction_IgnoreError,
2283 * The peer did something incorrect. Tell them.
2285 LDKErrorAction_SendErrorMessage,
2287 * Must be last for serialization purposes
2289 LDKErrorAction_Sentinel,
2290 } LDKErrorAction_Tag;
2292 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
2293 struct LDKErrorMessage msg;
2294 } LDKErrorAction_LDKDisconnectPeer_Body;
2296 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
2297 struct LDKErrorMessage msg;
2298 } LDKErrorAction_LDKSendErrorMessage_Body;
2300 typedef struct MUST_USE_STRUCT LDKErrorAction {
2301 LDKErrorAction_Tag tag;
2303 LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
2304 LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
2309 * The information we received from a peer along the route of a payment we originated. This is
2310 * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
2311 * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
2313 typedef enum LDKHTLCFailChannelUpdate_Tag {
2315 * We received an error which included a full ChannelUpdate message.
2317 LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
2319 * We received an error which indicated only that a channel has been closed
2321 LDKHTLCFailChannelUpdate_ChannelClosed,
2323 * We received an error which indicated only that a node has failed
2325 LDKHTLCFailChannelUpdate_NodeFailure,
2327 * Must be last for serialization purposes
2329 LDKHTLCFailChannelUpdate_Sentinel,
2330 } LDKHTLCFailChannelUpdate_Tag;
2332 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
2333 struct LDKChannelUpdate msg;
2334 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
2336 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
2337 uint64_t short_channel_id;
2339 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
2341 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
2342 struct LDKPublicKey node_id;
2344 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
2346 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
2347 LDKHTLCFailChannelUpdate_Tag tag;
2349 LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2350 LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
2351 LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
2353 } LDKHTLCFailChannelUpdate;
2356 * An event generated by ChannelManager which indicates a message should be sent to a peer (or
2357 * broadcast to most peers).
2358 * These events are handled by PeerManager::process_events if you are using a PeerManager.
2360 typedef enum LDKMessageSendEvent_Tag {
2362 * Used to indicate that we've accepted a channel open and should send the accept_channel
2363 * message provided to the given peer.
2365 LDKMessageSendEvent_SendAcceptChannel,
2367 * Used to indicate that we've initiated a channel open and should send the open_channel
2368 * message provided to the given peer.
2370 LDKMessageSendEvent_SendOpenChannel,
2372 * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
2374 LDKMessageSendEvent_SendFundingCreated,
2376 * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
2378 LDKMessageSendEvent_SendFundingSigned,
2380 * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
2382 LDKMessageSendEvent_SendFundingLocked,
2384 * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
2386 LDKMessageSendEvent_SendAnnouncementSignatures,
2388 * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
2389 * message should be sent to the peer with the given node_id.
2391 LDKMessageSendEvent_UpdateHTLCs,
2393 * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
2395 LDKMessageSendEvent_SendRevokeAndACK,
2397 * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
2399 LDKMessageSendEvent_SendClosingSigned,
2401 * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
2403 LDKMessageSendEvent_SendShutdown,
2405 * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
2407 LDKMessageSendEvent_SendChannelReestablish,
2409 * Used to indicate that a channel_announcement and channel_update should be broadcast to all
2410 * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
2412 * Note that after doing so, you very likely (unless you did so very recently) want to call
2413 * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
2414 * This ensures that any nodes which see our channel_announcement also have a relevant
2415 * node_announcement, including relevant feature flags which may be important for routing
2418 LDKMessageSendEvent_BroadcastChannelAnnouncement,
2420 * Used to indicate that a node_announcement should be broadcast to all peers.
2422 LDKMessageSendEvent_BroadcastNodeAnnouncement,
2424 * Used to indicate that a channel_update should be broadcast to all peers.
2426 LDKMessageSendEvent_BroadcastChannelUpdate,
2428 * Broadcast an error downstream to be handled
2430 LDKMessageSendEvent_HandleError,
2432 * When a payment fails we may receive updates back from the hop where it failed. In such
2433 * cases this event is generated so that we can inform the network graph of this information.
2435 LDKMessageSendEvent_PaymentFailureNetworkUpdate,
2437 * Query a peer for channels with funding transaction UTXOs in a block range.
2439 LDKMessageSendEvent_SendChannelRangeQuery,
2441 * Request routing gossip messages from a peer for a list of channels identified by
2442 * their short_channel_ids.
2444 LDKMessageSendEvent_SendShortIdsQuery,
2446 * Must be last for serialization purposes
2448 LDKMessageSendEvent_Sentinel,
2449 } LDKMessageSendEvent_Tag;
2451 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
2452 struct LDKPublicKey node_id;
2453 struct LDKAcceptChannel msg;
2454 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
2456 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
2457 struct LDKPublicKey node_id;
2458 struct LDKOpenChannel msg;
2459 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
2461 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
2462 struct LDKPublicKey node_id;
2463 struct LDKFundingCreated msg;
2464 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
2466 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
2467 struct LDKPublicKey node_id;
2468 struct LDKFundingSigned msg;
2469 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
2471 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
2472 struct LDKPublicKey node_id;
2473 struct LDKFundingLocked msg;
2474 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
2476 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
2477 struct LDKPublicKey node_id;
2478 struct LDKAnnouncementSignatures msg;
2479 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
2481 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
2482 struct LDKPublicKey node_id;
2483 struct LDKCommitmentUpdate updates;
2484 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
2486 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
2487 struct LDKPublicKey node_id;
2488 struct LDKRevokeAndACK msg;
2489 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
2491 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
2492 struct LDKPublicKey node_id;
2493 struct LDKClosingSigned msg;
2494 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
2496 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
2497 struct LDKPublicKey node_id;
2498 struct LDKShutdown msg;
2499 } LDKMessageSendEvent_LDKSendShutdown_Body;
2501 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
2502 struct LDKPublicKey node_id;
2503 struct LDKChannelReestablish msg;
2504 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
2506 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
2507 struct LDKChannelAnnouncement msg;
2508 struct LDKChannelUpdate update_msg;
2509 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
2511 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
2512 struct LDKNodeAnnouncement msg;
2513 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
2515 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
2516 struct LDKChannelUpdate msg;
2517 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
2519 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
2520 struct LDKPublicKey node_id;
2521 struct LDKErrorAction action;
2522 } LDKMessageSendEvent_LDKHandleError_Body;
2524 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
2525 struct LDKHTLCFailChannelUpdate update;
2526 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
2528 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
2529 struct LDKPublicKey node_id;
2530 struct LDKQueryChannelRange msg;
2531 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
2533 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
2534 struct LDKPublicKey node_id;
2535 struct LDKQueryShortChannelIds msg;
2536 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
2538 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
2539 LDKMessageSendEvent_Tag tag;
2541 LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
2542 LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
2543 LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
2544 LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
2545 LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
2546 LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
2547 LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
2548 LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
2549 LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
2550 LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
2551 LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
2552 LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
2553 LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
2554 LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
2555 LDKMessageSendEvent_LDKHandleError_Body handle_error;
2556 LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
2557 LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
2558 LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
2560 } LDKMessageSendEvent;
2562 typedef struct LDKCVecTempl_MessageSendEvent {
2563 struct LDKMessageSendEvent *data;
2565 } LDKCVecTempl_MessageSendEvent;
2567 typedef struct LDKCVecTempl_MessageSendEvent LDKCVec_MessageSendEventZ;
2570 * A trait indicating an object may generate message send events
2572 typedef struct LDKMessageSendEventsProvider {
2575 * Gets the list of pending events which were generated by previous actions, clearing the list
2578 LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
2579 void (*free)(void *this_arg);
2580 } LDKMessageSendEventsProvider;
2582 typedef struct LDKCVecTempl_Event {
2583 struct LDKEvent *data;
2585 } LDKCVecTempl_Event;
2587 typedef struct LDKCVecTempl_Event LDKCVec_EventZ;
2590 * A trait indicating an object may generate events
2592 typedef struct LDKEventsProvider {
2595 * Gets the list of pending events which were generated by previous actions, clearing the list
2598 LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
2599 void (*free)(void *this_arg);
2600 } LDKEventsProvider;
2605 * Configuration we set when applicable.
2607 * Default::default() provides sane defaults.
2609 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
2611 * Nearly everywhere, inner must be non-null, however in places where
2612 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2614 LDKnativeChannelHandshakeConfig *inner;
2616 } LDKChannelHandshakeConfig;
2621 * Optional channel limits which are applied during channel creation.
2623 * These limits are only applied to our counterparty's limits, not our own.
2625 * Use 0/<type>::max_value() as appropriate to skip checking.
2627 * Provides sane defaults for most configurations.
2629 * Most additional limits are disabled except those with which specify a default in individual
2630 * field documentation. Note that this may result in barely-usable channels, but since they
2631 * are applied mostly only to incoming channels that's not much of a problem.
2633 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
2635 * Nearly everywhere, inner must be non-null, however in places where
2636 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2638 LDKnativeChannelHandshakeLimits *inner;
2640 } LDKChannelHandshakeLimits;
2645 * Options which apply on a per-channel basis and may change at runtime or based on negotiation
2646 * with our counterparty.
2648 typedef struct MUST_USE_STRUCT LDKChannelConfig {
2650 * Nearly everywhere, inner must be non-null, however in places where
2651 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2653 LDKnativeChannelConfig *inner;
2660 * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
2662 * Default::default() provides sane defaults for most configurations
2663 * (but currently with 0 relay fees!)
2665 typedef struct MUST_USE_STRUCT LDKUserConfig {
2667 * Nearly everywhere, inner must be non-null, however in places where
2668 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2670 LDKnativeUserConfig *inner;
2675 * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
2678 typedef struct LDKAccess {
2681 * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
2682 * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
2685 * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
2687 struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
2688 void (*free)(void *this_arg);
2692 * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
2695 * This is useful in order to have a [`Watch`] implementation convey to a chain source which
2696 * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
2697 * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
2698 * receiving full blocks from a chain source, any further filtering is unnecessary.
2700 * After an output has been registered, subsequent block retrievals from the chain source must not
2701 * exclude any transactions matching the new criteria nor any in-block descendants of such
2704 * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
2705 * should not block on I/O. Implementations should instead queue the newly monitored data to be
2706 * processed later. Then, in order to block until the data has been processed, any `Watch`
2707 * invocation that has called the `Filter` must return [`TemporaryFailure`].
2709 * [`Watch`]: trait.Watch.html
2710 * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure
2711 * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
2712 * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
2714 typedef struct LDKFilter {
2717 * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
2718 * a spending condition.
2720 void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
2722 * Registers interest in spends of a transaction output identified by `outpoint` having
2723 * `script_pubkey` as the spending condition.
2725 void (*register_output)(const void *this_arg, const struct LDKOutPoint *NONNULL_PTR outpoint, struct LDKu8slice script_pubkey);
2726 void (*free)(void *this_arg);
2730 * `Persist` defines behavior for persisting channel monitors: this could mean
2731 * writing once to disk, and/or uploading to one or more backup services.
2733 * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
2734 * to disk/backups. And, on every update, you **must** persist either the
2735 * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
2736 * of situations such as revoking a transaction, then crashing before this
2737 * revocation can be persisted, then unintentionally broadcasting a revoked
2738 * transaction and losing money. This is a risk because previous channel states
2739 * are toxic, so it's important that whatever channel state is persisted is
2742 typedef struct LDKPersist {
2745 * Persist a new channel's data. The data can be stored any way you want, but
2746 * the identifier provided by Rust-Lightning is the channel's outpoint (and
2747 * it is up to you to maintain a correct mapping between the outpoint and the
2748 * stored channel data). Note that you **must** persist every new monitor to
2749 * disk. See the `Persist` trait documentation for more details.
2751 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
2752 * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
2754 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
2755 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
2757 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
2759 * Update one channel's data. The provided `ChannelMonitor` has already
2760 * applied the given update.
2762 * Note that on every update, you **must** persist either the
2763 * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
2764 * the `Persist` trait documentation for more details.
2766 * If an implementer chooses to persist the updates only, they need to make
2767 * sure that all the updates are applied to the `ChannelMonitors` *before*
2768 * the set of channel monitors is given to the `ChannelManager`
2769 * deserialization routine. See [`ChannelMonitor::update_monitor`] for
2770 * applying a monitor update to a monitor. If full `ChannelMonitors` are
2771 * persisted, then there is no need to persist individual updates.
2773 * Note that there could be a performance tradeoff between persisting complete
2774 * channel monitors on every update vs. persisting only updates and applying
2775 * them in batches. The size of each monitor grows `O(number of state updates)`
2776 * whereas updates are small and `O(1)`.
2778 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
2779 * [`ChannelMonitorUpdate::write`] for writing out an update, and
2780 * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
2782 * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1
2783 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
2784 * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write
2785 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
2787 struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data);
2788 void (*free)(void *this_arg);
2794 * An implementation of [`chain::Watch`] for monitoring channels.
2796 * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
2797 * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
2798 * or used independently to monitor channels remotely. See the [module-level documentation] for
2801 * [`chain::Watch`]: ../trait.Watch.html
2802 * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
2803 * [module-level documentation]: index.html
2805 typedef struct MUST_USE_STRUCT LDKChainMonitor {
2807 * Nearly everywhere, inner must be non-null, however in places where
2808 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2810 LDKnativeChainMonitor *inner;
2814 typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction {
2815 struct LDKC2TupleTempl_usize__Transaction *data;
2817 } LDKCVecTempl_C2TupleTempl_usize__Transaction;
2819 typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction LDKCVec_C2Tuple_usizeTransactionZZ;
2824 * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2825 * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2826 * preimage claim backward will lead to loss of funds.
2828 * [`chain::Watch`]: ../trait.Watch.html
2830 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2832 * Nearly everywhere, inner must be non-null, however in places where
2833 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2835 LDKnativeHTLCUpdate *inner;
2839 typedef struct LDKCVecTempl_Transaction {
2840 struct LDKTransaction *data;
2842 } LDKCVecTempl_Transaction;
2844 typedef struct LDKCVecTempl_Transaction LDKCVec_TransactionZ;
2846 typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut {
2847 struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut *data;
2849 } LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut;
2851 typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ;
2856 * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
2857 * and derives keys from that.
2859 * Your node_id is seed/0'
2860 * ChannelMonitor closes may use seed/1'
2861 * Cooperative closes may use seed/2'
2862 * The two close keys may be needed to claim on-chain funds!
2864 typedef struct MUST_USE_STRUCT LDKKeysManager {
2866 * Nearly everywhere, inner must be non-null, however in places where
2867 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2869 LDKnativeKeysManager *inner;
2876 * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2878 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2880 * Nearly everywhere, inner must be non-null, however in places where
2881 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2883 LDKnativeChannelDetails *inner;
2885 } LDKChannelDetails;
2890 * Features used within an `init` message.
2892 typedef struct MUST_USE_STRUCT LDKInitFeatures {
2894 * Nearly everywhere, inner must be non-null, however in places where
2895 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2897 LDKnativeInitFeatures *inner;
2901 typedef struct LDKCVecTempl_ChannelDetails {
2902 struct LDKChannelDetails *data;
2904 } LDKCVecTempl_ChannelDetails;
2906 typedef struct LDKCVecTempl_ChannelDetails LDKCVec_ChannelDetailsZ;
2908 typedef struct LDKThreeBytes {
2912 typedef struct LDKCVecTempl_NetAddress {
2913 struct LDKNetAddress *data;
2915 } LDKCVecTempl_NetAddress;
2917 typedef struct LDKCVecTempl_NetAddress LDKCVec_NetAddressZ;
2922 * An update_add_htlc message to be sent or received from a peer
2924 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
2926 * Nearly everywhere, inner must be non-null, however in places where
2927 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2929 LDKnativeUpdateAddHTLC *inner;
2936 * An update_fulfill_htlc message to be sent or received from a peer
2938 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
2940 * Nearly everywhere, inner must be non-null, however in places where
2941 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2943 LDKnativeUpdateFulfillHTLC *inner;
2945 } LDKUpdateFulfillHTLC;
2950 * An update_fail_htlc message to be sent or received from a peer
2952 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
2954 * Nearly everywhere, inner must be non-null, however in places where
2955 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2957 LDKnativeUpdateFailHTLC *inner;
2959 } LDKUpdateFailHTLC;
2964 * An update_fail_malformed_htlc message to be sent or received from a peer
2966 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
2968 * Nearly everywhere, inner must be non-null, however in places where
2969 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2971 LDKnativeUpdateFailMalformedHTLC *inner;
2973 } LDKUpdateFailMalformedHTLC;
2978 * A commitment_signed message to be sent or received from a peer
2980 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
2982 * Nearly everywhere, inner must be non-null, however in places where
2983 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2985 LDKnativeCommitmentSigned *inner;
2987 } LDKCommitmentSigned;
2992 * An update_fee message to be sent or received from a peer
2994 typedef struct MUST_USE_STRUCT LDKUpdateFee {
2996 * Nearly everywhere, inner must be non-null, however in places where
2997 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2999 LDKnativeUpdateFee *inner;
3004 * A trait to describe an object which can receive channel messages.
3006 * Messages MAY be called in parallel when they originate from different their_node_ids, however
3007 * they MUST NOT be called in parallel when the two calls have the same their_node_id.
3009 typedef struct LDKChannelMessageHandler {
3012 * Handle an incoming open_channel message from the given peer.
3014 void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
3016 * Handle an incoming accept_channel message from the given peer.
3018 void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
3020 * Handle an incoming funding_created message from the given peer.
3022 void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
3024 * Handle an incoming funding_signed message from the given peer.
3026 void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
3028 * Handle an incoming funding_locked message from the given peer.
3030 void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
3032 * Handle an incoming shutdown message from the given peer.
3034 void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg);
3036 * Handle an incoming closing_signed message from the given peer.
3038 void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
3040 * Handle an incoming update_add_htlc message from the given peer.
3042 void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
3044 * Handle an incoming update_fulfill_htlc message from the given peer.
3046 void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
3048 * Handle an incoming update_fail_htlc message from the given peer.
3050 void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
3052 * Handle an incoming update_fail_malformed_htlc message from the given peer.
3054 void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
3056 * Handle an incoming commitment_signed message from the given peer.
3058 void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
3060 * Handle an incoming revoke_and_ack message from the given peer.
3062 void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
3064 * Handle an incoming update_fee message from the given peer.
3066 void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
3068 * Handle an incoming announcement_signatures message from the given peer.
3070 void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
3072 * Indicates a connection to the peer failed/an existing connection was lost. If no connection
3073 * is believed to be possible in the future (eg they're sending us messages we don't
3074 * understand or indicate they require unknown feature bits), no_connection_possible is set
3075 * and any outstanding channels should be failed.
3077 void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
3079 * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
3081 void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
3083 * Handle an incoming channel_reestablish message from the given peer.
3085 void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
3087 * Handle an incoming error message from the given peer.
3089 void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
3090 struct LDKMessageSendEventsProvider MessageSendEventsProvider;
3091 void (*free)(void *this_arg);
3092 } LDKChannelMessageHandler;
3097 * Arguments for the creation of a ChannelManager that are not deserialized.
3099 * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
3101 * 1) Deserialize all stored ChannelMonitors.
3102 * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash,
3103 * ChannelManager)>::read(reader, args).
3104 * This may result in closing some Channels if the ChannelMonitor is newer than the stored
3105 * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
3106 * 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
3107 * ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo().
3108 * 4) Reconnect blocks on your ChannelMonitors.
3109 * 5) Move the ChannelMonitors into your local chain::Watch.
3110 * 6) Disconnect/connect blocks on the ChannelManager.
3112 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
3114 * Nearly everywhere, inner must be non-null, however in places where
3115 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3117 LDKnativeChannelManagerReadArgs *inner;
3119 } LDKChannelManagerReadArgs;
3121 typedef struct LDKCVecTempl_ChannelMonitor {
3122 struct LDKChannelMonitor *data;
3124 } LDKCVecTempl_ChannelMonitor;
3126 typedef struct LDKCVecTempl_ChannelMonitor LDKCVec_ChannelMonitorZ;
3131 * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
3132 * This is used to convince the recipient that the channel is at a certain commitment
3133 * number even if they lost that data due to a local failure. Of course, the peer may lie
3134 * and even later commitments may have been revoked.
3136 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
3138 * Nearly everywhere, inner must be non-null, however in places where
3139 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3141 LDKnativeDataLossProtect *inner;
3143 } LDKDataLossProtect;
3148 * Features used within a `node_announcement` message.
3150 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
3152 * Nearly everywhere, inner must be non-null, however in places where
3153 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3155 LDKnativeNodeFeatures *inner;
3162 * Features used within a `channel_announcement` message.
3164 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
3166 * Nearly everywhere, inner must be non-null, however in places where
3167 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3169 LDKnativeChannelFeatures *inner;
3171 } LDKChannelFeatures;
3173 typedef struct LDKCVecTempl_u64 {
3178 typedef struct LDKCVecTempl_u64 LDKCVec_u64Z;
3180 typedef struct LDKCVecTempl_UpdateAddHTLC {
3181 struct LDKUpdateAddHTLC *data;
3183 } LDKCVecTempl_UpdateAddHTLC;
3185 typedef struct LDKCVecTempl_UpdateAddHTLC LDKCVec_UpdateAddHTLCZ;
3187 typedef struct LDKCVecTempl_UpdateFulfillHTLC {
3188 struct LDKUpdateFulfillHTLC *data;
3190 } LDKCVecTempl_UpdateFulfillHTLC;
3192 typedef struct LDKCVecTempl_UpdateFulfillHTLC LDKCVec_UpdateFulfillHTLCZ;
3194 typedef struct LDKCVecTempl_UpdateFailHTLC {
3195 struct LDKUpdateFailHTLC *data;
3197 } LDKCVecTempl_UpdateFailHTLC;
3199 typedef struct LDKCVecTempl_UpdateFailHTLC LDKCVec_UpdateFailHTLCZ;
3201 typedef struct LDKCVecTempl_UpdateFailMalformedHTLC {
3202 struct LDKUpdateFailMalformedHTLC *data;
3204 } LDKCVecTempl_UpdateFailMalformedHTLC;
3206 typedef struct LDKCVecTempl_UpdateFailMalformedHTLC LDKCVec_UpdateFailMalformedHTLCZ;
3208 typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
3209 struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *data;
3211 } LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
3213 typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
3215 typedef struct LDKCVecTempl_NodeAnnouncement {
3216 struct LDKNodeAnnouncement *data;
3218 } LDKCVecTempl_NodeAnnouncement;
3220 typedef struct LDKCVecTempl_NodeAnnouncement LDKCVec_NodeAnnouncementZ;
3223 * A trait to describe an object which can receive routing messages.
3225 * # Implementor DoS Warnings
3227 * For `gossip_queries` messages there are potential DoS vectors when handling
3228 * inbound queries. Implementors using an on-disk network graph should be aware of
3229 * repeated disk I/O for queries accessing different parts of the network graph.
3231 typedef struct LDKRoutingMessageHandler {
3234 * Handle an incoming node_announcement message, returning true if it should be forwarded on,
3235 * false or returning an Err otherwise.
3237 struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
3239 * Handle a channel_announcement message, returning true if it should be forwarded on, false
3240 * or returning an Err otherwise.
3242 struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
3244 * Handle an incoming channel_update message, returning true if it should be forwarded on,
3245 * false or returning an Err otherwise.
3247 struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
3249 * Handle some updates to the route graph that we learned due to an outbound failed payment.
3251 void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
3253 * Gets a subset of the channel announcements and updates required to dump our routing table
3254 * to a remote node, starting at the short_channel_id indicated by starting_point and
3255 * including the batch_amount entries immediately higher in numerical value than starting_point.
3257 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
3259 * Gets a subset of the node announcements required to dump our routing table to a remote node,
3260 * starting at the node *after* the provided publickey and including batch_amount entries
3261 * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
3262 * If None is provided for starting_point, we start at the first node.
3264 LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
3266 * Called when a connection is established with a peer. This can be used to
3267 * perform routing table synchronization using a strategy defined by the
3270 void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
3272 * Handles the reply of a query we initiated to learn about channels
3273 * for a given range of blocks. We can expect to receive one or more
3274 * replies to a single query.
3276 struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
3278 * Handles the reply of a query we initiated asking for routing gossip
3279 * messages for a list of channels. We should receive this message when
3280 * a node has completed its best effort to send us the pertaining routing
3283 struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
3285 * Handles when a peer asks us to send a list of short_channel_ids
3286 * for the requested range of blocks.
3288 struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
3290 * Handles when a peer asks us to send routing gossip messages for a
3291 * list of short_channel_ids.
3293 struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
3294 struct LDKMessageSendEventsProvider MessageSendEventsProvider;
3295 void (*free)(void *this_arg);
3296 } LDKRoutingMessageHandler;
3301 * Provides references to trait impls which handle different types of messages.
3303 typedef struct MUST_USE_STRUCT LDKMessageHandler {
3305 * Nearly everywhere, inner must be non-null, however in places where
3306 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3308 LDKnativeMessageHandler *inner;
3310 } LDKMessageHandler;
3313 * Provides an object which can be used to send data to and which uniquely identifies a connection
3314 * to a remote host. You will need to be able to generate multiple of these which meet Eq and
3315 * implement Hash to meet the PeerManager API.
3317 * For efficiency, Clone should be relatively cheap for this type.
3319 * You probably want to just extend an int and put a file descriptor in a struct and implement
3320 * send_data. Note that if you are using a higher-level net library that may call close() itself,
3321 * be careful to ensure you don't have races whereby you might register a new connection with an
3322 * fd which is the same as a previous one which has yet to be removed via
3323 * PeerManager::socket_disconnected().
3325 typedef struct LDKSocketDescriptor {
3328 * Attempts to send some data from the given slice to the peer.
3330 * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
3331 * Note that in the disconnected case, socket_disconnected must still fire and further write
3332 * attempts may occur until that time.
3334 * If the returned size is smaller than data.len(), a write_available event must
3335 * trigger the next time more data can be written. Additionally, until the a send_data event
3336 * completes fully, no further read_events should trigger on the same peer!
3338 * If a read_event on this descriptor had previously returned true (indicating that read
3339 * events should be paused to prevent DoS in the send buffer), resume_read may be set
3340 * indicating that read events on this descriptor should resume. A resume_read of false does
3341 * *not* imply that further read events should be paused.
3343 uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
3345 * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
3346 * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
3347 * this descriptor. No socket_disconnected call should be generated as a result of this call,
3348 * though races may occur whereby disconnect_socket is called after a call to
3349 * socket_disconnected but prior to socket_disconnected returning.
3351 void (*disconnect_socket)(void *this_arg);
3352 bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
3353 uint64_t (*hash)(const void *this_arg);
3354 void *(*clone)(const void *this_arg);
3355 void (*free)(void *this_arg);
3356 } LDKSocketDescriptor;
3361 * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
3362 * events into messages which it passes on to its MessageHandlers.
3364 * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
3365 * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
3366 * essentially you should default to using a SimpleRefPeerManager, and use a
3367 * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
3368 * you're using lightning-net-tokio.
3370 typedef struct MUST_USE_STRUCT LDKPeerManager {
3372 * Nearly everywhere, inner must be non-null, however in places where
3373 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3375 LDKnativePeerManager *inner;
3379 typedef struct LDKCVecTempl_PublicKey {
3380 struct LDKPublicKey *data;
3382 } LDKCVecTempl_PublicKey;
3384 typedef struct LDKCVecTempl_PublicKey LDKCVec_PublicKeyZ;
3389 * Late-bound per-channel counterparty data used to build transactions.
3391 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
3393 * Nearly everywhere, inner must be non-null, however in places where
3394 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3396 LDKnativeCounterpartyChannelTransactionParameters *inner;
3398 } LDKCounterpartyChannelTransactionParameters;
3403 * Static channel fields used to build transactions given per-commitment fields, organized by
3404 * broadcaster/countersignatory.
3406 * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
3407 * as_holder_broadcastable and as_counterparty_broadcastable functions.
3409 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
3411 * Nearly everywhere, inner must be non-null, however in places where
3412 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3414 LDKnativeDirectedChannelTransactionParameters *inner;
3416 } LDKDirectedChannelTransactionParameters;
3421 * A pre-built Bitcoin commitment transaction and its txid.
3423 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
3425 * Nearly everywhere, inner must be non-null, however in places where
3426 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3428 LDKnativeBuiltCommitmentTransaction *inner;
3430 } LDKBuiltCommitmentTransaction;
3437 typedef struct MUST_USE_STRUCT LDKRouteHop {
3439 * Nearly everywhere, inner must be non-null, however in places where
3440 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3442 LDKnativeRouteHop *inner;
3446 typedef struct LDKCVecTempl_RouteHop {
3447 struct LDKRouteHop *data;
3449 } LDKCVecTempl_RouteHop;
3451 typedef struct LDKCVecTempl_CVecTempl_RouteHop {
3452 struct LDKCVecTempl_RouteHop *data;
3454 } LDKCVecTempl_CVecTempl_RouteHop;
3456 typedef struct LDKCVecTempl_CVecTempl_RouteHop LDKCVec_CVec_RouteHopZZ;
3461 * A channel descriptor which provides a last-hop route to get_route
3463 typedef struct MUST_USE_STRUCT LDKRouteHint {
3465 * Nearly everywhere, inner must be non-null, however in places where
3466 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3468 LDKnativeRouteHint *inner;
3472 typedef struct LDKCVecTempl_RouteHint {
3473 struct LDKRouteHint *data;
3475 } LDKCVecTempl_RouteHint;
3477 typedef struct LDKCVecTempl_RouteHint LDKCVec_RouteHintZ;
3482 * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
3483 * This exists only to make accessing a RwLock<NetworkGraph> possible from
3484 * the C bindings, as it can be done directly in Rust code.
3486 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
3488 * Nearly everywhere, inner must be non-null, however in places where
3489 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3491 LDKnativeLockedNetworkGraph *inner;
3493 } LDKLockedNetworkGraph;
3498 * Receives and validates network updates from peers,
3499 * stores authentic and relevant data as a network graph.
3500 * This network graph is then used for routing payments.
3501 * Provides interface to help with initial routing sync by
3502 * serving historical announcements.
3504 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
3506 * Nearly everywhere, inner must be non-null, however in places where
3507 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3509 LDKnativeNetGraphMsgHandler *inner;
3511 } LDKNetGraphMsgHandler;
3516 * Details about one direction of a channel. Received
3517 * within a channel update.
3519 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
3521 * Nearly everywhere, inner must be non-null, however in places where
3522 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3524 LDKnativeDirectionalChannelInfo *inner;
3526 } LDKDirectionalChannelInfo;
3531 * Details about a channel (both directions).
3532 * Received within a channel announcement.
3534 typedef struct MUST_USE_STRUCT LDKChannelInfo {
3536 * Nearly everywhere, inner must be non-null, however in places where
3537 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3539 LDKnativeChannelInfo *inner;
3543 typedef struct LDKCVecTempl_RouteHop LDKCVec_RouteHopZ;
3545 extern const void (*CVec_SpendableOutputDescriptorZ_free)(LDKCVec_SpendableOutputDescriptorZ);
3547 extern const void (*CVec_MessageSendEventZ_free)(LDKCVec_MessageSendEventZ);
3549 extern const void (*CVec_EventZ_free)(LDKCVec_EventZ);
3551 extern const void (*C2Tuple_usizeTransactionZ_free)(LDKC2Tuple_usizeTransactionZ);
3553 extern const void (*CVec_C2Tuple_usizeTransactionZZ_free)(LDKCVec_C2Tuple_usizeTransactionZZ);
3555 extern const void (*CVec_MonitorEventZ_free)(LDKCVec_MonitorEventZ);
3557 extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ);
3559 extern const void (*CVec_TransactionZ_free)(LDKCVec_TransactionZ);
3561 extern const void (*C2Tuple_u32TxOutZ_free)(LDKC2Tuple_u32TxOutZ);
3563 extern const void (*CVec_C2Tuple_u32TxOutZZ_free)(LDKCVec_C2Tuple_u32TxOutZZ);
3565 extern const void (*C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free)(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ);
3567 extern const void (*CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free)(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ);
3569 extern const void (*C2Tuple_BlockHashChannelMonitorZ_free)(LDKC2Tuple_BlockHashChannelMonitorZ);
3571 extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z);
3573 extern const void (*CVec_SignatureZ_free)(LDKCVec_SignatureZ);
3575 extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ);
3577 extern const void (*CVec_ChannelDetailsZ_free)(LDKCVec_ChannelDetailsZ);
3579 extern const void (*CVec_NetAddressZ_free)(LDKCVec_NetAddressZ);
3581 extern const void (*CVec_ChannelMonitorZ_free)(LDKCVec_ChannelMonitorZ);
3583 extern const void (*C2Tuple_BlockHashChannelManagerZ_free)(LDKC2Tuple_BlockHashChannelManagerZ);
3585 extern const void (*CVec_u64Z_free)(LDKCVec_u64Z);
3587 extern const void (*CVec_UpdateAddHTLCZ_free)(LDKCVec_UpdateAddHTLCZ);
3589 extern const void (*CVec_UpdateFulfillHTLCZ_free)(LDKCVec_UpdateFulfillHTLCZ);
3591 extern const void (*CVec_UpdateFailHTLCZ_free)(LDKCVec_UpdateFailHTLCZ);
3593 extern const void (*CVec_UpdateFailMalformedHTLCZ_free)(LDKCVec_UpdateFailMalformedHTLCZ);
3595 extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ);
3597 extern const void (*CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free)(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ);
3599 extern const void (*CVec_NodeAnnouncementZ_free)(LDKCVec_NodeAnnouncementZ);
3601 extern const void (*CVec_PublicKeyZ_free)(LDKCVec_PublicKeyZ);
3603 extern const void (*CVec_u8Z_free)(LDKCVec_u8Z);
3605 extern const void (*CVec_RouteHopZ_free)(LDKCVec_RouteHopZ);
3607 extern const void (*CVec_CVec_RouteHopZZ_free)(LDKCVec_CVec_RouteHopZZ);
3609 extern const void (*CVec_RouteHintZ_free)(LDKCVec_RouteHintZ);
3611 extern const uintptr_t MAX_BUF_SIZE;
3613 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
3615 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
3617 void Transaction_free(struct LDKTransaction _res);
3619 void TxOut_free(struct LDKTxOut _res);
3621 LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
3623 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
3625 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
3627 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
3629 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
3631 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
3633 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
3635 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
3637 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
3639 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
3641 LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, LDKCVec_u8Z b);
3643 LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
3645 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, LDKCVec_C2Tuple_u32TxOutZZ b);
3647 LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
3649 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor o);
3651 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
3653 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
3655 LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
3657 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
3659 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
3661 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
3663 LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, LDKCVec_SignatureZ b);
3665 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2TupleTempl_Signature__CVecTempl_Signature o);
3667 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
3669 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
3671 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
3673 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
3675 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
3677 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVecTempl_Signature o);
3679 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
3681 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
3683 struct LDKCResult_ChanKeySignerDecodeErrorZ CResult_ChanKeySignerDecodeErrorZ_ok(struct LDKChannelKeys o);
3685 struct LDKCResult_ChanKeySignerDecodeErrorZ CResult_ChanKeySignerDecodeErrorZ_err(struct LDKDecodeError e);
3687 void CResult_ChanKeySignerDecodeErrorZ_free(struct LDKCResult_ChanKeySignerDecodeErrorZ _res);
3689 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_ok(struct LDKInMemoryChannelKeys o);
3691 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_err(struct LDKDecodeError e);
3693 void CResult_InMemoryChannelKeysDecodeErrorZ_free(struct LDKCResult_InMemoryChannelKeysDecodeErrorZ _res);
3695 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
3697 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
3699 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
3701 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
3703 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
3705 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
3707 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
3709 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
3711 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
3713 LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
3715 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager o);
3717 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
3719 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
3721 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
3723 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
3725 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
3727 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
3729 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
3731 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
3733 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
3735 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
3737 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
3739 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
3741 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
3743 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
3745 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
3747 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
3749 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
3751 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
3753 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
3755 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
3757 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
3759 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
3761 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
3763 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
3765 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
3767 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
3769 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
3771 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
3773 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
3775 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
3777 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
3779 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
3781 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
3783 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
3785 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
3787 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
3789 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
3791 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
3793 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
3795 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
3797 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
3799 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
3801 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
3803 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
3805 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
3807 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
3809 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
3811 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
3813 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
3815 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
3817 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
3819 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
3821 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
3823 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
3825 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVecTempl_u8 o);
3827 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
3829 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
3831 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
3833 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
3835 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
3837 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
3839 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
3841 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
3843 struct LDKCResult_SecretKeySecpErrorZ CResult_SecretKeySecpErrorZ_ok(struct LDKSecretKey o);
3845 struct LDKCResult_SecretKeySecpErrorZ CResult_SecretKeySecpErrorZ_err(enum LDKSecp256k1Error e);
3847 void CResult_SecretKeySecpErrorZ_free(struct LDKCResult_SecretKeySecpErrorZ _res);
3849 struct LDKCResult_PublicKeySecpErrorZ CResult_PublicKeySecpErrorZ_ok(struct LDKPublicKey o);
3851 struct LDKCResult_PublicKeySecpErrorZ CResult_PublicKeySecpErrorZ_err(enum LDKSecp256k1Error e);
3853 void CResult_PublicKeySecpErrorZ_free(struct LDKCResult_PublicKeySecpErrorZ _res);
3855 struct LDKCResult_TxCreationKeysSecpErrorZ CResult_TxCreationKeysSecpErrorZ_ok(struct LDKTxCreationKeys o);
3857 struct LDKCResult_TxCreationKeysSecpErrorZ CResult_TxCreationKeysSecpErrorZ_err(enum LDKSecp256k1Error e);
3859 void CResult_TxCreationKeysSecpErrorZ_free(struct LDKCResult_TxCreationKeysSecpErrorZ _res);
3861 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
3863 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
3865 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
3867 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
3869 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
3871 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
3873 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
3875 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
3877 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
3879 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
3881 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
3883 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
3885 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
3887 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
3889 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
3891 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
3893 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
3895 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
3897 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
3899 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
3901 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
3903 void Event_free(struct LDKEvent this_ptr);
3905 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
3907 LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
3909 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
3911 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
3914 * Calls the free function if one is set
3916 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
3919 * Calls the free function if one is set
3921 void EventsProvider_free(struct LDKEventsProvider this_ptr);
3923 void APIError_free(struct LDKAPIError this_ptr);
3925 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
3927 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
3930 * Returns the most verbose logging level.
3932 MUST_USE_RES enum LDKLevel Level_max(void);
3935 * Calls the free function if one is set
3937 void Logger_free(struct LDKLogger this_ptr);
3939 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_ptr);
3941 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
3944 * Confirmations we will wait for before considering the channel locked in.
3945 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3946 * equivalent limit applied to outbound channels).
3950 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
3953 * Confirmations we will wait for before considering the channel locked in.
3954 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3955 * equivalent limit applied to outbound channels).
3959 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
3962 * Set to the amount of time we require our counterparty to wait to claim their money.
3964 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3965 * be online to check for peer having broadcast a revoked transaction to steal our funds
3966 * at least once every our_to_self_delay blocks.
3968 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3969 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3972 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3973 * opening so you can tweak config to ask for more security, not less.
3975 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
3978 * Set to the amount of time we require our counterparty to wait to claim their money.
3980 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
3981 * be online to check for peer having broadcast a revoked transaction to steal our funds
3982 * at least once every our_to_self_delay blocks.
3984 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
3985 * case of an honest unilateral channel close, which implicitly decrease the economic value of
3988 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
3989 * opening so you can tweak config to ask for more security, not less.
3991 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
3994 * Set to the smallest value HTLC we will accept to process.
3996 * This value is sent to our counterparty on channel-open and we close the channel any time
3997 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
3999 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
4002 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
4005 * Set to the smallest value HTLC we will accept to process.
4007 * This value is sent to our counterparty on channel-open and we close the channel any time
4008 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
4010 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
4013 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
4015 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg);
4017 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
4019 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_ptr);
4021 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
4024 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
4025 * only applies to inbound channels.
4029 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4032 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
4033 * only applies to inbound channels.
4037 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4040 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
4041 * you to limit the maximum minimum-size they can require.
4043 * Default value: u64::max_value.
4045 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4048 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
4049 * you to limit the maximum minimum-size they can require.
4051 * Default value: u64::max_value.
4053 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4056 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
4057 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
4061 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4064 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
4065 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
4069 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4072 * The remote node will require we keep a certain amount in direct payment to ourselves at all
4073 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
4074 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
4076 * Default value: u64::max_value.
4078 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4081 * The remote node will require we keep a certain amount in direct payment to ourselves at all
4082 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
4083 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
4085 * Default value: u64::max_value.
4087 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4090 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
4091 * time. This allows you to set a minimum such value.
4095 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4098 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
4099 * time. This allows you to set a minimum such value.
4103 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
4106 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
4107 * required to always be higher than this value so this only applies to HTLC outputs (and
4108 * potentially to-self outputs before any payments have been made).
4109 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4110 * This setting allows you to set a minimum dust limit for their commitment transactions,
4111 * reflecting the reality that tiny outputs are not considered standard transactions and will
4112 * not propagate through the Bitcoin network.
4114 * Default value: 546, the current dust limit on the Bitcoin network.
4116 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4119 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
4120 * required to always be higher than this value so this only applies to HTLC outputs (and
4121 * potentially to-self outputs before any payments have been made).
4122 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4123 * This setting allows you to set a minimum dust limit for their commitment transactions,
4124 * reflecting the reality that tiny outputs are not considered standard transactions and will
4125 * not propagate through the Bitcoin network.
4127 * Default value: 546, the current dust limit on the Bitcoin network.
4129 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4132 * Maximum allowed threshold above which outputs will not be generated in their commitment
4134 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4136 * Default value: u64::max_value.
4138 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4141 * Maximum allowed threshold above which outputs will not be generated in their commitment
4143 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4145 * Default value: u64::max_value.
4147 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4150 * Before a channel is usable the funding transaction will need to be confirmed by at least a
4151 * certain number of blocks, specified by the node which is not the funder (as the funder can
4152 * assume they aren't going to double-spend themselves).
4153 * This config allows you to set a limit on the maximum amount of time to wait.
4155 * Default value: 144, or roughly one day and only applies to outbound channels.
4157 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4160 * Before a channel is usable the funding transaction will need to be confirmed by at least a
4161 * certain number of blocks, specified by the node which is not the funder (as the funder can
4162 * assume they aren't going to double-spend themselves).
4163 * This config allows you to set a limit on the maximum amount of time to wait.
4165 * Default value: 144, or roughly one day and only applies to outbound channels.
4167 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
4170 * Set to force the incoming channel to match our announced channel preference in
4173 * Default value: true, to make the default that no announced channels are possible (which is
4174 * appropriate for any nodes which are not online very reliably).
4176 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4179 * Set to force the incoming channel to match our announced channel preference in
4182 * Default value: true, to make the default that no announced channels are possible (which is
4183 * appropriate for any nodes which are not online very reliably).
4185 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
4188 * Set to the amount of time we're willing to wait to claim money back to us.
4190 * Not checking this value would be a security issue, as our peer would be able to set it to
4191 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
4193 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
4194 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
4196 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4199 * Set to the amount of time we're willing to wait to claim money back to us.
4201 * Not checking this value would be a security issue, as our peer would be able to set it to
4202 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
4204 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
4205 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
4207 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
4209 MUST_USE_RES struct 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);
4211 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
4213 void ChannelConfig_free(struct LDKChannelConfig this_ptr);
4215 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
4218 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
4219 * This may be allowed to change at runtime in a later update, however doing so must result in
4220 * update messages sent to notify all nodes of our updated relay fee.
4224 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4227 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
4228 * This may be allowed to change at runtime in a later update, however doing so must result in
4229 * update messages sent to notify all nodes of our updated relay fee.
4233 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
4236 * Set to announce the channel publicly and notify all nodes that they can route via this
4239 * This should only be set to true for nodes which expect to be online reliably.
4241 * As the node which funds a channel picks this value this will only apply for new outbound
4242 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
4244 * This cannot be changed after the initial channel handshake.
4246 * Default value: false.
4248 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4251 * Set to announce the channel publicly and notify all nodes that they can route via this
4254 * This should only be set to true for nodes which expect to be online reliably.
4256 * As the node which funds a channel picks this value this will only apply for new outbound
4257 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
4259 * This cannot be changed after the initial channel handshake.
4261 * Default value: false.
4263 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
4266 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
4267 * supports it, they will then enforce the mutual-close output to us matches what we provided
4268 * at intialization, preventing us from closing to an alternate pubkey.
4270 * This is set to true by default to provide a slight increase in security, though ultimately
4271 * any attacker who is able to take control of a channel can just as easily send the funds via
4272 * lightning payments, so we never require that our counterparties support this option.
4274 * This cannot be changed after a channel has been initialized.
4276 * Default value: true.
4278 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4281 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
4282 * supports it, they will then enforce the mutual-close output to us matches what we provided
4283 * at intialization, preventing us from closing to an alternate pubkey.
4285 * This is set to true by default to provide a slight increase in security, though ultimately
4286 * any attacker who is able to take control of a channel can just as easily send the funds via
4287 * lightning payments, so we never require that our counterparties support this option.
4289 * This cannot be changed after a channel has been initialized.
4291 * Default value: true.
4293 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
4295 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
4297 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
4299 LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
4301 struct LDKChannelConfig ChannelConfig_read(struct LDKu8slice ser);
4303 void UserConfig_free(struct LDKUserConfig this_ptr);
4305 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
4308 * Channel config that we propose to our counterparty.
4310 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4313 * Channel config that we propose to our counterparty.
4315 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
4318 * Limits applied to our counterparty's proposed channel config settings.
4320 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4323 * Limits applied to our counterparty's proposed channel config settings.
4325 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
4328 * Channel config which affects behavior during channel lifetime.
4330 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4333 * Channel config which affects behavior during channel lifetime.
4335 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
4337 MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg);
4339 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
4341 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
4344 * Calls the free function if one is set
4346 void Access_free(struct LDKAccess this_ptr);
4349 * Calls the free function if one is set
4351 void Watch_free(struct LDKWatch this_ptr);
4354 * Calls the free function if one is set
4356 void Filter_free(struct LDKFilter this_ptr);
4359 * Calls the free function if one is set
4361 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
4363 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
4366 * Calls the free function if one is set
4368 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
4370 void ChainMonitor_free(struct LDKChainMonitor this_ptr);
4373 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
4374 * of a channel and reacting accordingly based on transactions in the connected block. See
4375 * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
4376 * be returned by [`chain::Watch::release_pending_monitor_events`].
4378 * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
4379 * calls must not exclude any transactions matching the new outputs nor any in-block
4380 * descendants of such transactions. It is not necessary to re-fetch the block to obtain
4383 * [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected
4384 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
4385 * [`chain::Filter`]: ../trait.Filter.html
4387 void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
4390 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
4391 * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
4394 * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
4396 void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
4399 * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
4401 * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
4402 * will call back to it indicating transactions and outputs of interest. This allows clients to
4403 * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
4404 * always need to fetch full blocks absent another means for determining which blocks contain
4405 * transactions relevant to the watched channels.
4407 * [`chain::Filter`]: ../trait.Filter.html
4409 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
4411 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
4413 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
4415 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_ptr);
4417 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
4420 * The sequence number of this update. Updates *must* be replayed in-order according to this
4421 * sequence number (and updates may panic if they are not). The update_id values are strictly
4422 * increasing and increase by one for each new update, with one exception specified below.
4424 * This sequence number is also used to track up to which points updates which returned
4425 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4426 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4428 * The only instance where update_id values are not strictly increasing is the case where we
4429 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
4430 * its docs for more details.
4432 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
4434 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
4437 * The sequence number of this update. Updates *must* be replayed in-order according to this
4438 * sequence number (and updates may panic if they are not). The update_id values are strictly
4439 * increasing and increase by one for each new update, with one exception specified below.
4441 * This sequence number is also used to track up to which points updates which returned
4442 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4443 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4445 * The only instance where update_id values are not strictly increasing is the case where we
4446 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
4447 * its docs for more details.
4449 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
4451 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
4453 LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
4455 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
4457 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
4459 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_ptr);
4461 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
4463 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
4465 void HTLCUpdate_free(struct LDKHTLCUpdate this_ptr);
4467 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
4469 LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
4471 struct LDKHTLCUpdate HTLCUpdate_read(struct LDKu8slice ser);
4473 void ChannelMonitor_free(struct LDKChannelMonitor this_ptr);
4475 LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
4478 * Updates a ChannelMonitor on the basis of some new information provided by the Channel
4481 * panics if the given update is not the next update by update_id.
4483 MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
4486 * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
4489 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
4492 * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
4494 MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
4497 * Get the list of HTLCs who's status has been updated on chain. This should be called by
4498 * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
4500 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
4502 MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
4505 * Gets the list of pending events which were generated by previous actions, clearing the list
4508 * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
4509 * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
4510 * no internal locking in ChannelMonitors.
4512 MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
4515 * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
4516 * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
4517 * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
4518 * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
4519 * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
4520 * broadcast them if counterparty don't close channel with his higher commitment transaction after a
4521 * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
4522 * out-of-band the other node operator to coordinate with him if option is available to you.
4523 * In any-case, choice is up to the user.
4525 MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger);
4528 * Processes transactions in a newly connected block, which may result in any of the following:
4529 * - update the monitor's state against resolved HTLCs
4530 * - punish the counterparty in the case of seeing a revoked commitment transaction
4531 * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
4532 * - detect settled outputs for later spending
4533 * - schedule and bump any in-flight claims
4535 * Returns any new outputs to watch from `txdata`; after called, these are also included in
4536 * [`get_outputs_to_watch`].
4538 * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
4540 MUST_USE_RES LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
4543 * Determines if the disconnected block contained any transactions of interest and updates
4546 void ChannelMonitor_block_disconnected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
4549 * Calls the free function if one is set
4551 void Persist_free(struct LDKPersist this_ptr);
4553 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
4555 void OutPoint_free(struct LDKOutPoint this_ptr);
4557 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
4560 * The referenced transaction's txid.
4562 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
4565 * The referenced transaction's txid.
4567 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4570 * The index of the referenced output in its transaction's vout.
4572 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
4575 * The index of the referenced output in its transaction's vout.
4577 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
4579 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
4582 * Convert an `OutPoint` to a lightning channel id.
4584 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
4586 LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
4588 struct LDKOutPoint OutPoint_read(struct LDKu8slice ser);
4590 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
4592 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
4594 LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
4596 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
4598 struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *NONNULL_PTR orig);
4601 * Calls the free function if one is set
4603 void ChannelKeys_free(struct LDKChannelKeys this_ptr);
4606 * Calls the free function if one is set
4608 void KeysInterface_free(struct LDKKeysInterface this_ptr);
4610 void InMemoryChannelKeys_free(struct LDKInMemoryChannelKeys this_ptr);
4612 struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *NONNULL_PTR orig);
4615 * Private key of anchor tx
4617 const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4620 * Private key of anchor tx
4622 void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4625 * Holder secret key for blinded revocation pubkey
4627 const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4630 * Holder secret key for blinded revocation pubkey
4632 void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4635 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4637 const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4640 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4642 void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4645 * Holder secret key used in HTLC tx
4647 const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4650 * Holder secret key used in HTLC tx
4652 void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4655 * Holder htlc secret key used in commitment tx htlc outputs
4657 const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4660 * Holder htlc secret key used in commitment tx htlc outputs
4662 void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4667 const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4672 void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4675 * Create a new InMemoryChannelKeys
4677 MUST_USE_RES struct LDKInMemoryChannelKeys InMemoryChannelKeys_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, LDKC2Tuple_u64u64Z key_derivation_params);
4680 * Counterparty pubkeys.
4681 * Will panic if ready_channel wasn't called.
4683 MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4686 * The contest_delay value specified by our counterparty and applied on holder-broadcastable
4687 * transactions, ie the amount of time that we have to wait to recover our funds if we
4688 * broadcast a transaction.
4689 * Will panic if ready_channel wasn't called.
4691 MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4694 * The contest_delay value specified by us and applied on transactions broadcastable
4695 * by our counterparty, ie the amount of time that they have to wait to recover their funds
4696 * if they broadcast a transaction.
4697 * Will panic if ready_channel wasn't called.
4699 MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4702 * Whether the holder is the initiator
4703 * Will panic if ready_channel wasn't called.
4705 MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4709 * Will panic if ready_channel wasn't called.
4711 MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4714 * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
4715 * building transactions.
4717 * Will panic if ready_channel wasn't called.
4719 MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4721 struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4723 LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj);
4725 struct LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser);
4727 void KeysManager_free(struct LDKKeysManager this_ptr);
4730 * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
4731 * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
4732 * starting_time isn't strictly required to actually be a time, but it must absolutely,
4733 * without a doubt, be unique to this instance. ie if you start multiple times with the same
4734 * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
4735 * simply use the current time (with very high precision).
4737 * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
4738 * obviously, starting_time should be unique every time you reload the library - it is only
4739 * used to generate new ephemeral key data (which will be stored by the individual channel if
4742 * Note that the seed is required to recover certain on-chain funds independent of
4743 * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
4744 * channel, and some on-chain during-closing funds.
4746 * Note that until the 0.1 release there is no guarantee of backward compatibility between
4747 * versions. Once the library is more fully supported, the docs will be updated to include a
4748 * detailed description of the guarantee.
4750 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], enum LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos);
4753 * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation
4755 * Key derivation parameters are accessible through a per-channel secrets
4756 * ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of
4757 * onchain output detection for which a corresponding delayed_payment_key must be derived.
4759 MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, uint64_t params_1, uint64_t params_2);
4761 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
4763 void ChannelManager_free(struct LDKChannelManager this_ptr);
4765 void ChannelDetails_free(struct LDKChannelDetails this_ptr);
4767 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
4770 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4771 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4772 * Note that this means this value is *not* persistent - it can change once during the
4773 * lifetime of the channel.
4775 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
4778 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4779 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4780 * Note that this means this value is *not* persistent - it can change once during the
4781 * lifetime of the channel.
4783 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4786 * The node_id of our counterparty
4788 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4791 * The node_id of our counterparty
4793 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
4796 * The Features the channel counterparty provided upon last connection.
4797 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4798 * many routing-relevant features are present in the init context.
4800 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4803 * The Features the channel counterparty provided upon last connection.
4804 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4805 * many routing-relevant features are present in the init context.
4807 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
4810 * The value, in satoshis, of this channel as appears in the funding output
4812 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4815 * The value, in satoshis, of this channel as appears in the funding output
4817 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4820 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4822 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4825 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4827 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4830 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4831 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4832 * available for inclusion in new outbound HTLCs). This further does not include any pending
4833 * outgoing HTLCs which are awaiting some other resolution to be sent.
4835 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4838 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4839 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4840 * available for inclusion in new outbound HTLCs). This further does not include any pending
4841 * outgoing HTLCs which are awaiting some other resolution to be sent.
4843 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4846 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4847 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4848 * available for inclusion in new inbound HTLCs).
4849 * Note that there are some corner cases not fully handled here, so the actual available
4850 * inbound capacity may be slightly higher than this.
4852 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4855 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4856 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4857 * available for inclusion in new inbound HTLCs).
4858 * Note that there are some corner cases not fully handled here, so the actual available
4859 * inbound capacity may be slightly higher than this.
4861 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4864 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4865 * the peer is connected, and (c) no monitor update failure is pending resolution.
4867 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4870 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4871 * the peer is connected, and (c) no monitor update failure is pending resolution.
4873 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
4875 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
4878 * Constructs a new ChannelManager to hold several channels and route between them.
4880 * This is the main \"logic hub\" for all channel-related actions, and implements
4881 * ChannelMessageHandler.
4883 * Non-proportional fees are fixed according to our risk using the provided fee estimator.
4885 * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
4887 * Users must provide the current blockchain height from which to track onchain channel
4888 * funding outpoints and send payments with reliable timelocks.
4890 * Users need to notify the new ChannelManager when a new block is connected or
4891 * disconnected using its `block_connected` and `block_disconnected` methods.
4893 MUST_USE_RES struct LDKChannelManager ChannelManager_new(enum LDKNetwork network, struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, uintptr_t current_blockchain_height);
4896 * Creates a new outbound channel to the given remote node and with the given value.
4898 * user_id will be provided back as user_channel_id in FundingGenerationReady and
4899 * FundingBroadcastSafe events to allow tracking of which events correspond with which
4900 * create_channel call. Note that user_channel_id defaults to 0 for inbound channels, so you
4901 * may wish to avoid using 0 for user_id here.
4903 * If successful, will generate a SendOpenChannel message event, so you should probably poll
4904 * PeerManager::process_events afterwards.
4906 * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
4907 * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
4909 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config);
4912 * Gets the list of open channels, in random order. See ChannelDetail field documentation for
4915 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4918 * Gets the list of usable channels, in random order. Useful as an argument to
4919 * get_route to ensure non-announced channels are used.
4921 * These are guaranteed to have their is_live value set to true, see the documentation for
4922 * ChannelDetails::is_live for more info on exactly what the criteria are.
4924 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4927 * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
4928 * will be accepted on the given channel, and after additional timeout/the closing of all
4929 * pending HTLCs, the channel will be closed on chain.
4931 * May generate a SendShutdown message event on success, which should be relayed.
4933 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
4936 * Force closes a channel, immediately broadcasting the latest local commitment transaction to
4937 * the chain and rejecting new HTLCs on the given channel.
4939 void ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
4942 * Force close all channels, immediately broadcasting the latest local commitment transaction
4943 * for each to the chain and rejecting new HTLCs on each.
4945 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4948 * Sends a payment along a given route.
4950 * Value parameters are provided via the last hop in route, see documentation for RouteHop
4951 * fields for more info.
4953 * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
4954 * payment), we don't do anything to stop you! We always try to ensure that if the provided
4955 * next hop knows the preimage to payment_hash they can claim an additional amount as
4956 * specified in the last hop in the route! Thus, you should probably do your own
4957 * payment_preimage tracking (which you should already be doing as they represent \"proof of
4958 * payment\") and prevent double-sends yourself.
4960 * May generate SendHTLCs message(s) event on success, which should be relayed.
4962 * Each path may have a different return value, and PaymentSendValue may return a Vec with
4963 * each entry matching the corresponding-index entry in the route paths, see
4964 * PaymentSendFailure for more info.
4966 * In general, a path may raise:
4967 * * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
4968 * node public key) is specified.
4969 * * APIError::ChannelUnavailable if the next-hop channel is not available for updates
4970 * (including due to previous monitor update failure or new permanent monitor update
4972 * * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
4975 * Note that depending on the type of the PaymentSendFailure the HTLC may have been
4976 * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
4977 * different route unless you intend to pay twice!
4979 * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
4980 * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
4981 * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
4982 * must not contain multiple paths as multi-path payments require a recipient-provided
4984 * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
4985 * bit set (either as required or as available). If multiple paths are present in the Route,
4986 * we assume the invoice had the basic_mpp feature set.
4988 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
4991 * Call this upon creation of a funding transaction for the given channel.
4993 * Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
4994 * or your counterparty can steal your funds!
4996 * Panics if a funding transaction has already been provided for this channel.
4998 * May panic if the funding_txo is duplicative with some other channel (note that this should
4999 * be trivially prevented by using unique funding transaction keys per-channel).
5001 void ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKOutPoint funding_txo);
5004 * Generates a signed node_announcement from the given arguments and creates a
5005 * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
5006 * seen a channel_announcement from us (ie unless we have public channels open).
5008 * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
5009 * to humans. They carry no in-protocol meaning.
5011 * addresses represent the set (possibly empty) of socket addresses on which this node accepts
5012 * incoming connections. These will be broadcast to the network, publicly tying these
5013 * addresses together. If you wish to preserve user privacy, addresses should likely contain
5014 * only Tor Onion addresses.
5016 * Panics if addresses is absurdly large (more than 500).
5018 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, LDKCVec_NetAddressZ addresses);
5021 * Processes HTLCs which are pending waiting on random forward delay.
5023 * Should only really ever be called in response to a PendingHTLCsForwardable event.
5024 * Will likely generate further events.
5026 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
5029 * If a peer is disconnected we mark any channels with that peer as 'disabled'.
5030 * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
5031 * to inform the network about the uselessness of these channels.
5033 * This method handles all the details, and must be called roughly once per minute.
5035 void ChannelManager_timer_chan_freshness_every_min(const struct LDKChannelManager *NONNULL_PTR this_arg);
5038 * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
5039 * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
5040 * along the path (including in our own channel on which we received it).
5041 * Returns false if no payment was found to fail backwards, true if the process of failing the
5042 * HTLC backwards has been started.
5044 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKThirtyTwoBytes payment_secret);
5047 * Provides a payment preimage in response to a PaymentReceived event, returning true and
5048 * generating message events for the net layer to claim the payment, if possible. Thus, you
5049 * should probably kick the net layer to go send messages if this returns true!
5051 * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
5052 * available within a few percent of the expected amount. This is critical for several
5053 * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
5054 * payment_preimage without having provided the full value and b) it avoids certain
5055 * privacy-breaking recipient-probing attacks which may reveal payment activity to
5056 * motivated attackers.
5058 * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
5059 * set. Thus, for such payments we will claim any payments which do not under-pay.
5061 * May panic if called except in response to a PaymentReceived event.
5063 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t expected_amount);
5066 * Gets the node_id held by this ChannelManager
5068 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
5071 * Restores a single, given channel to normal operation after a
5072 * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
5075 * All ChannelMonitor updates up to and including highest_applied_update_id must have been
5076 * fully committed in every copy of the given channels' ChannelMonitors.
5078 * Note that there is no effect to calling with a highest_applied_update_id other than the
5079 * current latest ChannelMonitorUpdate and one call to this function after multiple
5080 * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
5081 * exists largely only to prevent races between this and concurrent update_monitor calls.
5083 * Thus, the anticipated use is, at a high level:
5084 * 1) You register a chain::Watch with this ChannelManager,
5085 * 2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
5086 * said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
5087 * any time it cannot do so instantly,
5088 * 3) update(s) are applied to each remote copy of a ChannelMonitor,
5089 * 4) once all remote copies are updated, you call this function with the update_id that
5090 * completed, and once it is the latest the Channel will be re-enabled.
5092 void ChannelManager_channel_monitor_updated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOutPoint *NONNULL_PTR funding_txo, uint64_t highest_applied_update_id);
5094 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
5096 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
5099 * Updates channel state based on transactions seen in a connected block.
5101 void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
5104 * Updates channel state based on a disconnected block.
5106 * If necessary, the channel may be force-closed without letting the counterparty participate
5109 void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]);
5111 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
5113 LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
5115 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_ptr);
5118 * The keys provider which will give us relevant keys. Some keys will be loaded during
5119 * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
5122 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5125 * The keys provider which will give us relevant keys. Some keys will be loaded during
5126 * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
5129 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
5132 * The fee_estimator for use in the ChannelManager in the future.
5134 * No calls to the FeeEstimator will be made during deserialization.
5136 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5139 * The fee_estimator for use in the ChannelManager in the future.
5141 * No calls to the FeeEstimator will be made during deserialization.
5143 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
5146 * The chain::Watch for use in the ChannelManager in the future.
5148 * No calls to the chain::Watch will be made during deserialization. It is assumed that
5149 * you have deserialized ChannelMonitors separately and will add them to your
5150 * chain::Watch after deserializing this ChannelManager.
5152 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5155 * The chain::Watch for use in the ChannelManager in the future.
5157 * No calls to the chain::Watch will be made during deserialization. It is assumed that
5158 * you have deserialized ChannelMonitors separately and will add them to your
5159 * chain::Watch after deserializing this ChannelManager.
5161 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
5164 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
5165 * used to broadcast the latest local commitment transactions of channels which must be
5166 * force-closed during deserialization.
5168 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5171 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
5172 * used to broadcast the latest local commitment transactions of channels which must be
5173 * force-closed during deserialization.
5175 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
5178 * The Logger for use in the ChannelManager and which may be used to log information during
5181 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5184 * The Logger for use in the ChannelManager and which may be used to log information during
5187 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
5190 * Default settings used for new channels. Any existing channels will continue to use the
5191 * runtime settings which were stored when the ChannelManager was serialized.
5193 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5196 * Default settings used for new channels. Any existing channels will continue to use the
5197 * runtime settings which were stored when the ChannelManager was serialized.
5199 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
5202 * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
5203 * HashMap for you. This is primarily useful for C bindings where it is not practical to
5204 * populate a HashMap directly from C.
5206 MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, LDKCVec_ChannelMonitorZ channel_monitors);
5208 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
5210 void DecodeError_free(struct LDKDecodeError this_ptr);
5212 void Init_free(struct LDKInit this_ptr);
5214 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
5216 void ErrorMessage_free(struct LDKErrorMessage this_ptr);
5218 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
5221 * The channel ID involved in the error
5223 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
5226 * The channel ID involved in the error
5228 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5231 * A possibly human-readable error description.
5232 * The string should be sanitized before it is used (e.g. emitted to logs
5233 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
5234 * vulnerability in the terminal emulator or the logging subsystem.
5236 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
5239 * A possibly human-readable error description.
5240 * The string should be sanitized before it is used (e.g. emitted to logs
5241 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
5242 * vulnerability in the terminal emulator or the logging subsystem.
5244 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, LDKCVec_u8Z val);
5246 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z data_arg);
5248 void Ping_free(struct LDKPing this_ptr);
5250 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
5253 * The desired response length
5255 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
5258 * The desired response length
5260 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
5263 * The ping packet size.
5264 * This field is not sent on the wire. byteslen zeros are sent.
5266 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
5269 * The ping packet size.
5270 * This field is not sent on the wire. byteslen zeros are sent.
5272 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
5274 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
5276 void Pong_free(struct LDKPong this_ptr);
5278 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
5281 * The pong packet size.
5282 * This field is not sent on the wire. byteslen zeros are sent.
5284 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
5287 * The pong packet size.
5288 * This field is not sent on the wire. byteslen zeros are sent.
5290 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
5292 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
5294 void OpenChannel_free(struct LDKOpenChannel this_ptr);
5296 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
5299 * The genesis hash of the blockchain where the channel is to be opened
5301 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
5304 * The genesis hash of the blockchain where the channel is to be opened
5306 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5309 * A temporary channel ID, until the funding outpoint is announced
5311 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
5314 * A temporary channel ID, until the funding outpoint is announced
5316 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5321 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5326 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5329 * The amount to push to the counterparty as part of the open, in milli-satoshi
5331 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5334 * The amount to push to the counterparty as part of the open, in milli-satoshi
5336 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5339 * The threshold below which outputs on transactions broadcast by sender will be omitted
5341 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5344 * The threshold below which outputs on transactions broadcast by sender will be omitted
5346 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5349 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5351 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5354 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5356 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5359 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5361 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5364 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5366 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5369 * The minimum HTLC size incoming to sender, in milli-satoshi
5371 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5374 * The minimum HTLC size incoming to sender, in milli-satoshi
5376 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5379 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
5381 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5384 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
5386 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
5389 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5391 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5394 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5396 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
5399 * The maximum number of inbound HTLCs towards sender
5401 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5404 * The maximum number of inbound HTLCs towards sender
5406 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
5409 * The sender's key controlling the funding transaction
5411 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5414 * The sender's key controlling the funding transaction
5416 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5419 * Used to derive a revocation key for transactions broadcast by counterparty
5421 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5424 * Used to derive a revocation key for transactions broadcast by counterparty
5426 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5429 * A payment key to sender for transactions broadcast by counterparty
5431 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5434 * A payment key to sender for transactions broadcast by counterparty
5436 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5439 * Used to derive a payment key to sender for transactions broadcast by sender
5441 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5444 * Used to derive a payment key to sender for transactions broadcast by sender
5446 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5449 * Used to derive an HTLC payment key to sender
5451 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5454 * Used to derive an HTLC payment key to sender
5456 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5459 * The first to-be-broadcast-by-sender transaction's per commitment point
5461 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5464 * The first to-be-broadcast-by-sender transaction's per commitment point
5466 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5471 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5476 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
5478 void AcceptChannel_free(struct LDKAcceptChannel this_ptr);
5480 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
5483 * A temporary channel ID, until the funding outpoint is announced
5485 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
5488 * A temporary channel ID, until the funding outpoint is announced
5490 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5493 * The threshold below which outputs on transactions broadcast by sender will be omitted
5495 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5498 * The threshold below which outputs on transactions broadcast by sender will be omitted
5500 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5503 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5505 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5508 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5510 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5513 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5515 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5518 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5520 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5523 * The minimum HTLC size incoming to sender, in milli-satoshi
5525 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5528 * The minimum HTLC size incoming to sender, in milli-satoshi
5530 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5533 * Minimum depth of the funding transaction before the channel is considered open
5535 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5538 * Minimum depth of the funding transaction before the channel is considered open
5540 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
5543 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5545 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5548 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5550 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
5553 * The maximum number of inbound HTLCs towards sender
5555 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5558 * The maximum number of inbound HTLCs towards sender
5560 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
5563 * The sender's key controlling the funding transaction
5565 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5568 * The sender's key controlling the funding transaction
5570 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5573 * Used to derive a revocation key for transactions broadcast by counterparty
5575 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5578 * Used to derive a revocation key for transactions broadcast by counterparty
5580 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5583 * A payment key to sender for transactions broadcast by counterparty
5585 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5588 * A payment key to sender for transactions broadcast by counterparty
5590 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5593 * Used to derive a payment key to sender for transactions broadcast by sender
5595 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5598 * Used to derive a payment key to sender for transactions broadcast by sender
5600 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5603 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
5605 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5608 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
5610 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5613 * The first to-be-broadcast-by-sender transaction's per commitment point
5615 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5618 * The first to-be-broadcast-by-sender transaction's per commitment point
5620 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5622 void FundingCreated_free(struct LDKFundingCreated this_ptr);
5624 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
5627 * A temporary channel ID, until the funding is established
5629 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
5632 * A temporary channel ID, until the funding is established
5634 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5637 * The funding transaction ID
5639 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
5642 * The funding transaction ID
5644 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5647 * The specific output index funding this channel
5649 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
5652 * The specific output index funding this channel
5654 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
5657 * The signature of the channel initiator (funder) on the funding transaction
5659 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
5662 * The signature of the channel initiator (funder) on the funding transaction
5664 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
5666 MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg);
5668 void FundingSigned_free(struct LDKFundingSigned this_ptr);
5670 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
5675 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
5680 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5683 * The signature of the channel acceptor (fundee) on the funding transaction
5685 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
5688 * The signature of the channel acceptor (fundee) on the funding transaction
5690 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5692 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
5694 void FundingLocked_free(struct LDKFundingLocked this_ptr);
5696 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
5701 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
5706 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5709 * The per-commitment point of the second commitment transaction
5711 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
5714 * The per-commitment point of the second commitment transaction
5716 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5718 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
5720 void Shutdown_free(struct LDKShutdown this_ptr);
5722 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
5727 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
5732 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5735 * The destination of this peer's funds on closing.
5736 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5738 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
5741 * The destination of this peer's funds on closing.
5742 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5744 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, LDKCVec_u8Z val);
5746 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z scriptpubkey_arg);
5748 void ClosingSigned_free(struct LDKClosingSigned this_ptr);
5750 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
5755 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
5760 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5763 * The proposed total fee for the closing transaction
5765 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
5768 * The proposed total fee for the closing transaction
5770 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
5773 * A signature on the closing transaction
5775 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
5778 * A signature on the closing transaction
5780 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5782 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
5784 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_ptr);
5786 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
5791 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
5796 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5801 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5806 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
5809 * The HTLC value in milli-satoshi
5811 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5814 * The HTLC value in milli-satoshi
5816 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
5819 * The payment hash, the pre-image of which controls HTLC redemption
5821 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
5824 * The payment hash, the pre-image of which controls HTLC redemption
5826 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5829 * The expiry height of the HTLC
5831 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5834 * The expiry height of the HTLC
5836 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
5838 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_ptr);
5840 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
5845 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
5850 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5855 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
5860 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
5863 * The pre-image of the payment hash, allowing HTLC redemption
5865 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
5868 * The pre-image of the payment hash, allowing HTLC redemption
5870 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5872 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
5874 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_ptr);
5876 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
5881 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
5886 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5891 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
5896 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
5898 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_ptr);
5900 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
5905 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
5910 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5915 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
5920 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
5925 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
5930 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
5932 void CommitmentSigned_free(struct LDKCommitmentSigned this_ptr);
5934 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
5939 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
5944 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5947 * A signature on the commitment transaction
5949 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
5952 * A signature on the commitment transaction
5954 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5957 * Signatures on the HTLC transactions
5959 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, LDKCVec_SignatureZ val);
5961 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, LDKCVec_SignatureZ htlc_signatures_arg);
5963 void RevokeAndACK_free(struct LDKRevokeAndACK this_ptr);
5965 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
5970 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
5975 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5978 * The secret corresponding to the per-commitment point
5980 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
5983 * The secret corresponding to the per-commitment point
5985 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5988 * The next sender-broadcast commitment transaction's per-commitment point
5990 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
5993 * The next sender-broadcast commitment transaction's per-commitment point
5995 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5997 MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg);
5999 void UpdateFee_free(struct LDKUpdateFee this_ptr);
6001 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
6006 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
6011 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6014 * Fee rate per 1000-weight of the transaction
6016 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
6019 * Fee rate per 1000-weight of the transaction
6021 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
6023 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
6025 void DataLossProtect_free(struct LDKDataLossProtect this_ptr);
6027 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
6030 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
6031 * belonging to the recipient
6033 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
6036 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
6037 * belonging to the recipient
6039 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6042 * The sender's per-commitment point for their current commitment transaction
6044 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
6047 * The sender's per-commitment point for their current commitment transaction
6049 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6051 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
6053 void ChannelReestablish_free(struct LDKChannelReestablish this_ptr);
6055 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
6060 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
6065 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6068 * The next commitment number for the sender
6070 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
6073 * The next commitment number for the sender
6075 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
6078 * The next commitment number for the recipient
6080 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
6083 * The next commitment number for the recipient
6085 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
6087 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_ptr);
6089 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
6094 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
6099 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6102 * The short channel ID
6104 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6107 * The short channel ID
6109 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
6112 * A signature by the node key
6114 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6117 * A signature by the node key
6119 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
6122 * A signature by the funding key
6124 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6127 * A signature by the funding key
6129 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
6131 MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKSignature node_signature_arg, struct LDKSignature bitcoin_signature_arg);
6133 void NetAddress_free(struct LDKNetAddress this_ptr);
6135 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
6137 LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
6139 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
6141 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_ptr);
6143 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
6146 * The advertised features
6148 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6151 * The advertised features
6153 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
6156 * A strictly monotonic announcement counter, with gaps allowed
6158 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6161 * A strictly monotonic announcement counter, with gaps allowed
6163 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
6166 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
6169 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6172 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
6175 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6178 * An RGB color for UI purposes
6180 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
6183 * An RGB color for UI purposes
6185 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
6188 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
6191 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
6194 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
6197 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6200 * List of addresses on which this node is reachable
6202 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, LDKCVec_NetAddressZ val);
6204 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_ptr);
6206 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
6209 * The signature by the node key
6211 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
6214 * The signature by the node key
6216 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6219 * The actual content of the announcement
6221 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
6224 * The actual content of the announcement
6226 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
6228 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
6230 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_ptr);
6232 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
6235 * The advertised channel features
6237 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6240 * The advertised channel features
6242 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
6245 * The genesis hash of the blockchain where the channel is to be opened
6247 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
6250 * The genesis hash of the blockchain where the channel is to be opened
6252 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6255 * The short channel ID
6257 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6260 * The short channel ID
6262 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
6265 * One of the two node_ids which are endpoints of this channel
6267 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6270 * One of the two node_ids which are endpoints of this channel
6272 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6275 * The other of the two node_ids which are endpoints of this channel
6277 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6280 * The other of the two node_ids which are endpoints of this channel
6282 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6285 * The funding key for the first node
6287 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6290 * The funding key for the first node
6292 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6295 * The funding key for the second node
6297 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6300 * The funding key for the second node
6302 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6304 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_ptr);
6306 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
6309 * Authentication of the announcement by the first public node
6311 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6314 * Authentication of the announcement by the first public node
6316 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6319 * Authentication of the announcement by the second public node
6321 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6324 * Authentication of the announcement by the second public node
6326 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6329 * Proof of funding UTXO ownership by the first public node
6331 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6334 * Proof of funding UTXO ownership by the first public node
6336 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6339 * Proof of funding UTXO ownership by the second public node
6341 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6344 * Proof of funding UTXO ownership by the second public node
6346 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6349 * The actual announcement
6351 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6354 * The actual announcement
6356 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
6358 MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSignature node_signature_1_arg, struct LDKSignature node_signature_2_arg, struct LDKSignature bitcoin_signature_1_arg, struct LDKSignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg);
6360 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_ptr);
6362 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
6365 * The genesis hash of the blockchain where the channel is to be opened
6367 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
6370 * The genesis hash of the blockchain where the channel is to be opened
6372 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6375 * The short channel ID
6377 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6380 * The short channel ID
6382 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
6385 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
6387 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6390 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
6392 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6397 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6402 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
6405 * The number of blocks to subtract from incoming HTLC cltv_expiry values
6407 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6410 * The number of blocks to subtract from incoming HTLC cltv_expiry values
6412 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
6415 * The minimum HTLC size incoming to sender, in milli-satoshi
6417 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6420 * The minimum HTLC size incoming to sender, in milli-satoshi
6422 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
6425 * The base HTLC fee charged by sender, in milli-satoshi
6427 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6430 * The base HTLC fee charged by sender, in milli-satoshi
6432 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6435 * The amount to fee multiplier, in micro-satoshi
6437 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6440 * The amount to fee multiplier, in micro-satoshi
6442 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6444 void ChannelUpdate_free(struct LDKChannelUpdate this_ptr);
6446 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
6449 * A signature of the channel update
6451 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
6454 * A signature of the channel update
6456 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
6459 * The actual channel update
6461 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
6464 * The actual channel update
6466 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
6468 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
6470 void QueryChannelRange_free(struct LDKQueryChannelRange this_ptr);
6472 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
6475 * The genesis hash of the blockchain being queried
6477 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
6480 * The genesis hash of the blockchain being queried
6482 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6485 * The height of the first block for the channel UTXOs being queried
6487 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
6490 * The height of the first block for the channel UTXOs being queried
6492 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6495 * The number of blocks to include in the query results
6497 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
6500 * The number of blocks to include in the query results
6502 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6504 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
6506 void ReplyChannelRange_free(struct LDKReplyChannelRange this_ptr);
6508 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
6511 * The genesis hash of the blockchain being queried
6513 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
6516 * The genesis hash of the blockchain being queried
6518 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6521 * The height of the first block in the range of the reply
6523 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6526 * The height of the first block in the range of the reply
6528 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6531 * The number of blocks included in the range of the reply
6533 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6536 * The number of blocks included in the range of the reply
6538 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6541 * Indicates if the query recipient maintains up-to-date channel
6542 * information for the chain_hash
6544 bool ReplyChannelRange_get_full_information(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6547 * Indicates if the query recipient maintains up-to-date channel
6548 * information for the chain_hash
6550 void ReplyChannelRange_set_full_information(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
6553 * The short_channel_ids in the channel range
6555 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, LDKCVec_u64Z val);
6557 MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool full_information_arg, LDKCVec_u64Z short_channel_ids_arg);
6559 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_ptr);
6561 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
6564 * The genesis hash of the blockchain being queried
6566 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
6569 * The genesis hash of the blockchain being queried
6571 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6574 * The short_channel_ids that are being queried
6576 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, LDKCVec_u64Z val);
6578 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, LDKCVec_u64Z short_channel_ids_arg);
6580 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_ptr);
6582 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
6585 * The genesis hash of the blockchain that was queried
6587 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
6590 * The genesis hash of the blockchain that was queried
6592 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6595 * Indicates if the query recipient maintains up-to-date channel
6596 * information for the chain_hash
6598 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
6601 * Indicates if the query recipient maintains up-to-date channel
6602 * information for the chain_hash
6604 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
6606 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
6608 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_ptr);
6610 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
6613 * The genesis hash of the blockchain for channel and node information
6615 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
6618 * The genesis hash of the blockchain for channel and node information
6620 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6623 * The starting unix timestamp
6625 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
6628 * The starting unix timestamp
6630 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
6633 * The range of information in seconds
6635 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
6638 * The range of information in seconds
6640 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
6642 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
6644 void ErrorAction_free(struct LDKErrorAction this_ptr);
6646 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
6648 void LightningError_free(struct LDKLightningError this_ptr);
6651 * A human-readable message describing the error
6653 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
6656 * A human-readable message describing the error
6658 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, LDKCVec_u8Z val);
6661 * The action which should be taken against the offending peer.
6663 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
6666 * The action which should be taken against the offending peer.
6668 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
6670 MUST_USE_RES struct LDKLightningError LightningError_new(LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
6672 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_ptr);
6674 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
6677 * update_add_htlc messages which should be sent
6679 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateAddHTLCZ val);
6682 * update_fulfill_htlc messages which should be sent
6684 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFulfillHTLCZ val);
6687 * update_fail_htlc messages which should be sent
6689 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFailHTLCZ val);
6692 * update_fail_malformed_htlc messages which should be sent
6694 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFailMalformedHTLCZ val);
6697 * An update_fee message which should be sent
6699 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
6702 * An update_fee message which should be sent
6704 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
6707 * Finally, the commitment_signed message which should be sent
6709 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
6712 * Finally, the commitment_signed message which should be sent
6714 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
6716 MUST_USE_RES struct 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, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg);
6718 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
6720 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
6723 * Calls the free function if one is set
6725 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
6728 * Calls the free function if one is set
6730 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
6732 LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
6734 struct LDKAcceptChannel AcceptChannel_read(struct LDKu8slice ser);
6736 LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
6738 struct LDKAnnouncementSignatures AnnouncementSignatures_read(struct LDKu8slice ser);
6740 LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
6742 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
6744 LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
6746 struct LDKClosingSigned ClosingSigned_read(struct LDKu8slice ser);
6748 LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
6750 struct LDKCommitmentSigned CommitmentSigned_read(struct LDKu8slice ser);
6752 LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
6754 struct LDKFundingCreated FundingCreated_read(struct LDKu8slice ser);
6756 LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
6758 struct LDKFundingSigned FundingSigned_read(struct LDKu8slice ser);
6760 LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
6762 struct LDKFundingLocked FundingLocked_read(struct LDKu8slice ser);
6764 LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
6766 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
6768 LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
6770 struct LDKOpenChannel OpenChannel_read(struct LDKu8slice ser);
6772 LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
6774 struct LDKRevokeAndACK RevokeAndACK_read(struct LDKu8slice ser);
6776 LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
6778 struct LDKShutdown Shutdown_read(struct LDKu8slice ser);
6780 LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
6782 struct LDKUpdateFailHTLC UpdateFailHTLC_read(struct LDKu8slice ser);
6784 LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
6786 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
6788 LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
6790 struct LDKUpdateFee UpdateFee_read(struct LDKu8slice ser);
6792 LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
6794 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(struct LDKu8slice ser);
6796 LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
6798 struct LDKUpdateAddHTLC UpdateAddHTLC_read(struct LDKu8slice ser);
6800 LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
6802 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
6804 LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
6806 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
6808 LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
6810 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
6812 LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
6814 struct LDKChannelAnnouncement ChannelAnnouncement_read(struct LDKu8slice ser);
6816 LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
6818 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
6820 LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
6822 struct LDKChannelUpdate ChannelUpdate_read(struct LDKu8slice ser);
6824 LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
6826 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
6828 LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
6830 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
6832 LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
6834 struct LDKNodeAnnouncement NodeAnnouncement_read(struct LDKu8slice ser);
6836 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
6838 LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
6840 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
6842 LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
6844 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
6846 LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
6848 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
6850 LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
6852 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
6854 LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
6856 void MessageHandler_free(struct LDKMessageHandler this_ptr);
6859 * A message handler which handles messages specific to channels. Usually this is just a
6860 * ChannelManager object.
6862 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
6865 * A message handler which handles messages specific to channels. Usually this is just a
6866 * ChannelManager object.
6868 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
6871 * A message handler which handles messages updating our knowledge of the network channel
6872 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6874 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
6877 * A message handler which handles messages updating our knowledge of the network channel
6878 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6880 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
6882 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
6884 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
6887 * Calls the free function if one is set
6889 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
6891 void PeerHandleError_free(struct LDKPeerHandleError this_ptr);
6894 * Used to indicate that we probably can't make any future connections to this peer, implying
6895 * we should go ahead and force-close any channels we have with it.
6897 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
6900 * Used to indicate that we probably can't make any future connections to this peer, implying
6901 * we should go ahead and force-close any channels we have with it.
6903 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
6905 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
6907 void PeerManager_free(struct LDKPeerManager this_ptr);
6910 * Constructs a new PeerManager with the given message handlers and node_id secret key
6911 * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
6912 * cryptographically secure random bytes.
6914 MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger);
6917 * Get the list of node ids for peers which have completed the initial handshake.
6919 * For outbound connections, this will be the same as the their_node_id parameter passed in to
6920 * new_outbound_connection, however entries will only appear once the initial handshake has
6921 * completed and we are sure the remote peer has the private key for the given node_id.
6923 MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
6926 * Indicates a new outbound connection has been established to a node with the given node_id.
6927 * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
6928 * descriptor but must disconnect the connection immediately.
6930 * Returns a small number of bytes to send to the remote node (currently always 50).
6932 * Panics if descriptor is duplicative with some other descriptor which has not yet had a
6933 * socket_disconnected().
6935 MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor);
6938 * Indicates a new inbound connection has been established.
6940 * May refuse the connection by returning an Err, but will never write bytes to the remote end
6941 * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
6942 * call socket_disconnected for the new descriptor but must disconnect the connection
6945 * Panics if descriptor is duplicative with some other descriptor which has not yet had
6946 * socket_disconnected called.
6948 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
6951 * Indicates that there is room to write data to the given socket descriptor.
6953 * May return an Err to indicate that the connection should be closed.
6955 * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
6956 * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
6957 * invariants around calling write_buffer_space_avail in case a write did not fully complete
6958 * must still hold - be ready to call write_buffer_space_avail again if a write call generated
6959 * here isn't sufficient! Panics if the descriptor was not previously registered in a
6960 * new_\\*_connection event.
6962 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
6965 * Indicates that data was read from the given socket descriptor.
6967 * May return an Err to indicate that the connection should be closed.
6969 * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
6970 * Thus, however, you almost certainly want to call process_events() after any read_event to
6971 * generate send_data calls to handle responses.
6973 * If Ok(true) is returned, further read_events should not be triggered until a send_data call
6974 * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
6976 * Panics if the descriptor was not previously registered in a new_*_connection event.
6978 MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data);
6981 * Checks for any events generated by our handlers and processes them. Includes sending most
6982 * response messages as well as messages generated by calls to handler functions directly (eg
6983 * functions like ChannelManager::process_pending_htlc_forward or send_payment).
6985 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
6988 * Indicates that the given socket descriptor's connection is now closed.
6990 * This must only be called if the socket has been disconnected by the peer or your own
6991 * decision to disconnect it and must NOT be called in any case where other parts of this
6992 * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
6995 * Panics if the descriptor was not previously registered in a successful new_*_connection event.
6997 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
7000 * This function should be called roughly once every 30 seconds.
7001 * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
7002 * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
7004 void PeerManager_timer_tick_occured(const struct LDKPeerManager *NONNULL_PTR this_arg);
7007 * Build the commitment secret from the seed and the commitment number
7009 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
7012 * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
7013 * from the base secret and the per_commitment_point.
7015 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7016 * generated (ie our own).
7018 struct LDKCResult_SecretKeySecpErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
7021 * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
7022 * from the base point and the per_commitment_key. This is the public equivalent of
7023 * derive_private_key - using only public keys to derive a public key instead of private keys.
7025 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7026 * generated (ie our own).
7028 struct LDKCResult_PublicKeySecpErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
7031 * Derives a per-commitment-transaction revocation key from its constituent parts.
7033 * Only the cheating participant owns a valid witness to propagate a revoked
7034 * commitment transaction, thus per_commitment_secret always come from cheater
7035 * and revocation_base_secret always come from punisher, which is the broadcaster
7036 * of the transaction spending with this key knowledge.
7038 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7039 * generated (ie our own).
7041 struct LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
7044 * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
7045 * the public equivalend of derive_private_revocation_key - using only public keys to derive a
7046 * public key instead of private keys.
7048 * Only the cheating participant owns a valid witness to propagate a revoked
7049 * commitment transaction, thus per_commitment_point always come from cheater
7050 * and revocation_base_point always come from punisher, which is the broadcaster
7051 * of the transaction spending with this key knowledge.
7053 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7054 * generated (ie our own).
7056 struct LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
7058 void TxCreationKeys_free(struct LDKTxCreationKeys this_ptr);
7060 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
7063 * The broadcaster's per-commitment public key which was used to derive the other keys.
7065 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7068 * The broadcaster's per-commitment public key which was used to derive the other keys.
7070 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7073 * The revocation key which is used to allow the broadcaster of the commitment
7074 * transaction to provide their counterparty the ability to punish them if they broadcast
7077 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7080 * The revocation key which is used to allow the broadcaster of the commitment
7081 * transaction to provide their counterparty the ability to punish them if they broadcast
7084 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7087 * Broadcaster's HTLC Key
7089 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7092 * Broadcaster's HTLC Key
7094 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7097 * Countersignatory's HTLC Key
7099 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7102 * Countersignatory's HTLC Key
7104 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7107 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
7109 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7112 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
7114 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7116 MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKPublicKey revocation_key_arg, struct LDKPublicKey broadcaster_htlc_key_arg, struct LDKPublicKey countersignatory_htlc_key_arg, struct LDKPublicKey broadcaster_delayed_payment_key_arg);
7118 LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
7120 struct LDKTxCreationKeys TxCreationKeys_read(struct LDKu8slice ser);
7122 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_ptr);
7124 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
7127 * The public key which is used to sign all commitment transactions, as it appears in the
7128 * on-chain channel lock-in 2-of-2 multisig output.
7130 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7133 * The public key which is used to sign all commitment transactions, as it appears in the
7134 * on-chain channel lock-in 2-of-2 multisig output.
7136 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7139 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
7140 * revocation keys. This is combined with the per-commitment-secret generated by the
7141 * counterparty to create a secret which the counterparty can reveal to revoke previous
7144 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7147 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
7148 * revocation keys. This is combined with the per-commitment-secret generated by the
7149 * counterparty to create a secret which the counterparty can reveal to revoke previous
7152 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7155 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
7156 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
7157 * static across every commitment transaction.
7159 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7162 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
7163 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
7164 * static across every commitment transaction.
7166 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7169 * The base point which is used (with derive_public_key) to derive a per-commitment payment
7170 * public key which receives non-HTLC-encumbered funds which are only available for spending
7171 * after some delay (or can be claimed via the revocation path).
7173 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7176 * The base point which is used (with derive_public_key) to derive a per-commitment payment
7177 * public key which receives non-HTLC-encumbered funds which are only available for spending
7178 * after some delay (or can be claimed via the revocation path).
7180 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7183 * The base point which is used (with derive_public_key) to derive a per-commitment public key
7184 * which is used to encumber HTLC-in-flight outputs.
7186 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7189 * The base point which is used (with derive_public_key) to derive a per-commitment public key
7190 * which is used to encumber HTLC-in-flight outputs.
7192 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7194 MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg);
7196 LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
7198 struct LDKChannelPublicKeys ChannelPublicKeys_read(struct LDKu8slice ser);
7201 * Create per-state keys from channel base points and the per-commitment point.
7202 * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
7204 MUST_USE_RES struct LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base);
7207 * Generate per-state keys from channel static keys.
7208 * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
7210 MUST_USE_RES struct LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
7213 * A script either spendable by the revocation
7214 * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
7215 * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
7217 LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
7219 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_ptr);
7221 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
7224 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
7225 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
7226 * need to compare this value to whether the commitment transaction in question is that of
7227 * the counterparty or our own.
7229 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7232 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
7233 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
7234 * need to compare this value to whether the commitment transaction in question is that of
7235 * the counterparty or our own.
7237 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
7240 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
7241 * this divided by 1000.
7243 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7246 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
7247 * this divided by 1000.
7249 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
7252 * The CLTV lock-time at which this HTLC expires.
7254 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7257 * The CLTV lock-time at which this HTLC expires.
7259 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
7262 * The hash of the preimage which unlocks this HTLC.
7264 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
7267 * The hash of the preimage which unlocks this HTLC.
7269 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7271 LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
7273 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(struct LDKu8slice ser);
7276 * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
7277 * does not need to have its previous_output_index filled.
7279 LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
7282 * Gets the redeemscript for a funding output from the two funding public keys.
7283 * Note that the order of funding public keys does not matter.
7285 LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
7288 * panics if htlc.transaction_output_index.is_none()!
7290 struct LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
7292 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_ptr);
7294 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
7297 * Holder public keys
7299 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7302 * Holder public keys
7304 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
7307 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
7309 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7312 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
7314 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
7317 * Whether the holder is the initiator of this channel.
7318 * This is an input to the commitment number obscure factor computation.
7320 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7323 * Whether the holder is the initiator of this channel.
7324 * This is an input to the commitment number obscure factor computation.
7326 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
7329 * The late-bound counterparty channel transaction parameters.
7330 * These parameters are populated at the point in the protocol where the counterparty provides them.
7332 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7335 * The late-bound counterparty channel transaction parameters.
7336 * These parameters are populated at the point in the protocol where the counterparty provides them.
7338 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
7341 * The late-bound funding outpoint
7343 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7346 * The late-bound funding outpoint
7348 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
7350 MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg);
7352 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_ptr);
7354 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
7357 * Counter-party public keys
7359 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
7362 * Counter-party public keys
7364 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
7367 * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
7369 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
7372 * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
7374 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
7376 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
7379 * Whether the late bound parameters are populated.
7381 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7384 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
7385 * given that the holder is the broadcaster.
7387 * self.is_populated() must be true before calling this function.
7389 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7392 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
7393 * given that the counterparty is the broadcaster.
7395 * self.is_populated() must be true before calling this function.
7397 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7399 LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
7401 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
7403 LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
7405 struct LDKChannelTransactionParameters ChannelTransactionParameters_read(struct LDKu8slice ser);
7407 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_ptr);
7410 * Get the channel pubkeys for the broadcaster
7412 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7415 * Get the channel pubkeys for the countersignatory
7417 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7420 * Get the contest delay applicable to the transactions.
7421 * Note that the contest delay was selected by the countersignatory.
7423 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7426 * Whether the channel is outbound from the broadcaster.
7428 * The boolean representing the side that initiated the channel is
7429 * an input to the commitment number obscure factor computation.
7431 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7434 * The funding outpoint
7436 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7438 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_ptr);
7440 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
7443 * Our counterparty's signature for the transaction
7445 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
7448 * Our counterparty's signature for the transaction
7450 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
7453 * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
7455 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, LDKCVec_SignatureZ val);
7457 LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
7459 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(struct LDKu8slice ser);
7462 * Create a new holder transaction with the given counterparty signatures.
7463 * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
7465 MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key);
7467 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_ptr);
7469 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
7472 * The commitment transaction
7474 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
7477 * The commitment transaction
7479 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
7482 * The txid for the commitment transaction.
7484 * This is provided as a performance optimization, instead of calling transaction.txid()
7487 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
7490 * The txid for the commitment transaction.
7492 * This is provided as a performance optimization, instead of calling transaction.txid()
7495 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7497 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
7499 LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
7501 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_read(struct LDKu8slice ser);
7504 * Get the SIGHASH_ALL sighash value of the transaction.
7506 * This can be used to verify a signature.
7508 MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
7511 * Sign a transaction, either because we are counter-signing the counterparty's transaction or
7512 * because we are about to broadcast a holder transaction.
7514 MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
7516 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_ptr);
7518 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
7520 LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
7522 struct LDKCommitmentTransaction CommitmentTransaction_read(struct LDKu8slice ser);
7525 * The backwards-counting commitment number
7527 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7530 * The value to be sent to the broadcaster
7532 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7535 * The value to be sent to the counterparty
7537 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7540 * The feerate paid per 1000-weight-unit in this commitment transaction.
7542 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7545 * Trust our pre-built transaction and derived transaction creation public keys.
7547 * Applies a wrapper which allows access to these fields.
7549 * This should only be used if you fully trust the builder of this object. It should not
7550 *\tbe used by an external signer - instead use the verify function.
7552 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7555 * Verify our pre-built transaction and derived transaction creation public keys.
7557 * Applies a wrapper which allows access to these fields.
7559 * An external validating signer must call this method before signing
7560 * or using the built transaction.
7562 MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
7564 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_ptr);
7567 * The transaction ID of the built Bitcoin transaction
7569 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7572 * The pre-built Bitcoin commitment transaction
7574 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7577 * The pre-calculated transaction creation public keys.
7579 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7582 * Get a signature for each HTLC which was included in the commitment transaction (ie for
7583 * which HTLCOutputInCommitment::transaction_output_index.is_some()).
7585 * The returned Vec has one entry for each HTLC, and in the same order.
7587 MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters);
7590 * Get the transaction number obscure factor
7592 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
7594 void InitFeatures_free(struct LDKInitFeatures this_ptr);
7596 void NodeFeatures_free(struct LDKNodeFeatures this_ptr);
7598 void ChannelFeatures_free(struct LDKChannelFeatures this_ptr);
7600 void RouteHop_free(struct LDKRouteHop this_ptr);
7602 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
7605 * The node_id of the node at this hop.
7607 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7610 * The node_id of the node at this hop.
7612 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7615 * The node_announcement features of the node at this hop. For the last hop, these may be
7616 * amended to match the features present in the invoice this node generated.
7618 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7621 * The node_announcement features of the node at this hop. For the last hop, these may be
7622 * amended to match the features present in the invoice this node generated.
7624 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
7627 * The channel that should be used from the previous hop to reach this node.
7629 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7632 * The channel that should be used from the previous hop to reach this node.
7634 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
7637 * The channel_announcement features of the channel that should be used from the previous hop
7638 * to reach this node.
7640 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7643 * The channel_announcement features of the channel that should be used from the previous hop
7644 * to reach this node.
7646 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
7649 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
7651 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7654 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
7656 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
7659 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
7660 * expected at the destination, in excess of the current block height.
7662 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7665 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
7666 * expected at the destination, in excess of the current block height.
7668 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
7670 MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg);
7672 void Route_free(struct LDKRoute this_ptr);
7674 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
7677 * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
7678 * last RouteHop in each path must be the same.
7679 * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
7680 * destination. Thus, this must always be at least length one. While the maximum length of any
7681 * given path is variable, keeping the length of any path to less than 20 should currently
7682 * ensure it is viable.
7684 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, LDKCVec_CVec_RouteHopZZ val);
7686 MUST_USE_RES struct LDKRoute Route_new(LDKCVec_CVec_RouteHopZZ paths_arg);
7688 LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
7690 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
7692 void RouteHint_free(struct LDKRouteHint this_ptr);
7694 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
7697 * The node_id of the non-target end of the route
7699 struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7702 * The node_id of the non-target end of the route
7704 void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7707 * The short_channel_id of this channel
7709 uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7712 * The short_channel_id of this channel
7714 void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
7717 * The fees which must be paid to use this channel
7719 struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7722 * The fees which must be paid to use this channel
7724 void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
7727 * The difference in CLTV values between this node and the next node.
7729 uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7732 * The difference in CLTV values between this node and the next node.
7734 void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val);
7737 * The minimum value, in msat, which must be relayed to the next hop.
7739 uint64_t RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7742 * The minimum value, in msat, which must be relayed to the next hop.
7744 void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
7746 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg);
7749 * Gets a route from us to the given target node.
7751 * Extra routing hops between known nodes and the target will be used if they are included in
7754 * If some channels aren't announced, it may be useful to fill in a first_hops with the
7755 * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
7756 * view of our local channels (from net_graph_msg_handler) will be ignored, and only those in first_hops
7759 * Panics if first_hops contains channels without short_channel_ids
7760 * (ChannelManager::list_usable_channels will never include such channels).
7762 * The fees on channels from us to next-hops are ignored (as they are assumed to all be
7763 * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat
7764 * *is* checked as they may change based on the receiving node.
7766 struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey target, LDKCVec_ChannelDetailsZ *first_hops, LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
7768 void NetworkGraph_free(struct LDKNetworkGraph this_ptr);
7770 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr);
7772 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr);
7775 * Creates a new tracker of the actual state of the network of channels and nodes,
7776 * assuming a fresh network graph.
7777 * Chain monitor is used to make sure announced channels exist on-chain,
7778 * channel data is correct, and that the announcement is signed with
7779 * channel owners' keys.
7781 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
7784 * Creates a new tracker of the actual state of the network of channels and nodes,
7785 * assuming an existing Network Graph.
7787 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
7790 * Take a read lock on the network_graph and return it in the C-bindings
7791 * newtype helper. This is likely only useful when called via the C
7792 * bindings as you can call `self.network_graph.read().unwrap()` in Rust
7795 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7798 * Get a reference to the NetworkGraph which this read-lock contains.
7800 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
7802 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7804 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7806 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_ptr);
7809 * When the last update to the channel direction was issued.
7810 * Value is opaque, as set in the announcement.
7812 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7815 * When the last update to the channel direction was issued.
7816 * Value is opaque, as set in the announcement.
7818 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
7821 * Whether the channel can be currently used for payments (in this one direction).
7823 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7826 * Whether the channel can be currently used for payments (in this one direction).
7828 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
7831 * The difference in CLTV values that you must have when routing through this channel.
7833 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7836 * The difference in CLTV values that you must have when routing through this channel.
7838 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
7841 * The minimum value, which must be relayed to the next hop via the channel
7843 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7846 * The minimum value, which must be relayed to the next hop via the channel
7848 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
7851 * Fees charged when the channel is used for routing
7853 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7856 * Fees charged when the channel is used for routing
7858 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
7861 * Most recent update for the channel received from the network
7862 * Mostly redundant with the data we store in fields explicitly.
7863 * Everything else is useful only for sending out for initial routing sync.
7864 * Not stored if contains excess data to prevent DoS.
7866 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7869 * Most recent update for the channel received from the network
7870 * Mostly redundant with the data we store in fields explicitly.
7871 * Everything else is useful only for sending out for initial routing sync.
7872 * Not stored if contains excess data to prevent DoS.
7874 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
7876 LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
7878 struct LDKDirectionalChannelInfo DirectionalChannelInfo_read(struct LDKu8slice ser);
7880 void ChannelInfo_free(struct LDKChannelInfo this_ptr);
7883 * Protocol features of a channel communicated during its announcement
7885 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7888 * Protocol features of a channel communicated during its announcement
7890 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
7893 * Source node of the first direction of a channel
7895 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7898 * Source node of the first direction of a channel
7900 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7903 * Details about the first direction of a channel
7905 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7908 * Details about the first direction of a channel
7910 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
7913 * Source node of the second direction of a channel
7915 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7918 * Source node of the second direction of a channel
7920 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7923 * Details about the second direction of a channel
7925 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7928 * Details about the second direction of a channel
7930 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
7933 * An initial announcement of the channel
7934 * Mostly redundant with the data we store in fields explicitly.
7935 * Everything else is useful only for sending out for initial routing sync.
7936 * Not stored if contains excess data to prevent DoS.
7938 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7941 * An initial announcement of the channel
7942 * Mostly redundant with the data we store in fields explicitly.
7943 * Everything else is useful only for sending out for initial routing sync.
7944 * Not stored if contains excess data to prevent DoS.
7946 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
7948 LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
7950 struct LDKChannelInfo ChannelInfo_read(struct LDKu8slice ser);
7952 void RoutingFees_free(struct LDKRoutingFees this_ptr);
7954 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
7957 * Flat routing fee in satoshis
7959 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
7962 * Flat routing fee in satoshis
7964 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
7967 * Liquidity-based routing fee in millionths of a routed amount.
7968 * In other words, 10000 is 1%.
7970 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
7973 * Liquidity-based routing fee in millionths of a routed amount.
7974 * In other words, 10000 is 1%.
7976 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
7978 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
7980 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
7982 LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
7984 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_ptr);
7987 * Protocol features the node announced support for
7989 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
7992 * Protocol features the node announced support for
7994 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
7997 * When the last known update to the node state was issued.
7998 * Value is opaque, as set in the announcement.
8000 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
8003 * When the last known update to the node state was issued.
8004 * Value is opaque, as set in the announcement.
8006 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
8009 * Color assigned to the node
8011 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
8014 * Color assigned to the node
8016 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
8019 * Moniker assigned to the node.
8020 * May be invalid or malicious (eg control chars),
8021 * should not be exposed to the user.
8023 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
8026 * Moniker assigned to the node.
8027 * May be invalid or malicious (eg control chars),
8028 * should not be exposed to the user.
8030 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8033 * Internet-level addresses via which one can connect to the node
8035 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, LDKCVec_NetAddressZ val);
8038 * An initial announcement of the node
8039 * Mostly redundant with the data we store in fields explicitly.
8040 * Everything else is useful only for sending out for initial routing sync.
8041 * Not stored if contains excess data to prevent DoS.
8043 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
8046 * An initial announcement of the node
8047 * Mostly redundant with the data we store in fields explicitly.
8048 * Everything else is useful only for sending out for initial routing sync.
8049 * Not stored if contains excess data to prevent DoS.
8051 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
8053 MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
8055 LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
8057 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
8059 void NodeInfo_free(struct LDKNodeInfo this_ptr);
8062 * All valid channels a node has announced
8064 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, LDKCVec_u64Z val);
8067 * Lowest fees enabling routing via any of the enabled, known channels to a node.
8068 * The two fields (flat and proportional fee) are independent,
8069 * meaning they don't have to refer to the same channel.
8071 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
8074 * Lowest fees enabling routing via any of the enabled, known channels to a node.
8075 * The two fields (flat and proportional fee) are independent,
8076 * meaning they don't have to refer to the same channel.
8078 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
8081 * More information about a node from node_announcement.
8082 * Optional because we store a Node entry after learning about it from
8083 * a channel announcement, but before receiving a node announcement.
8085 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
8088 * More information about a node from node_announcement.
8089 * Optional because we store a Node entry after learning about it from
8090 * a channel announcement, but before receiving a node announcement.
8092 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
8094 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
8096 LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
8098 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
8100 LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
8102 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
8105 * Creates a new, empty, network graph.
8107 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
8110 * For an already known node (from channel announcements), update its stored properties from a
8111 * given node announcement.
8113 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8114 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8115 * routing messages from a source using a protocol other than the lightning P2P protocol.
8117 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8120 * For an already known node (from channel announcements), update its stored properties from a
8121 * given node announcement without verifying the associated signatures. Because we aren't
8122 * given the associated signatures here we cannot relay the node announcement to any of our
8125 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
8128 * Store or update channel info from a channel announcement.
8130 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8131 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8132 * routing messages from a source using a protocol other than the lightning P2P protocol.
8134 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
8135 * the corresponding UTXO exists on chain and is correctly-formatted.
8137 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
8140 * Store or update channel info from a channel announcement without verifying the associated
8141 * signatures. Because we aren't given the associated signatures here we cannot relay the
8142 * channel announcement to any of our peers.
8144 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
8145 * the corresponding UTXO exists on chain and is correctly-formatted.
8147 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
8150 * Close a channel if a corresponding HTLC fail was sent.
8151 * If permanent, removes a channel from the local storage.
8152 * May cause the removal of nodes too, if this was their last channel.
8153 * If not permanent, makes channels unavailable for routing.
8155 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
8158 * For an already known (from announcement) channel, update info about one of the directions
8161 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8162 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8163 * routing messages from a source using a protocol other than the lightning P2P protocol.
8165 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8168 * For an already known (from announcement) channel, update info about one of the directions
8169 * of the channel without verifying the associated signatures. Because we aren't given the
8170 * associated signatures here we cannot relay the channel update to any of our peers.
8172 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
8174 /* Text to put at the end of the generated file */