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 LDKCResultPtr_u8__ChannelMonitorUpdateErr {
234 enum LDKChannelMonitorUpdateErr *err;
235 } LDKCResultPtr_u8__ChannelMonitorUpdateErr;
237 typedef struct LDKCResultTempl_u8__ChannelMonitorUpdateErr {
238 union LDKCResultPtr_u8__ChannelMonitorUpdateErr contents;
240 } LDKCResultTempl_u8__ChannelMonitorUpdateErr;
242 typedef struct LDKCResultTempl_u8__ChannelMonitorUpdateErr LDKCResult_NoneChannelMonitorUpdateErrZ;
247 * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
248 * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
249 * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
251 * Contains a developer-readable error message.
253 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
255 * Nearly everywhere, inner must be non-null, however in places where
256 * the Rust equivalent takes an Option, it may be set to null to indicate None.
258 LDKnativeMonitorUpdateError *inner;
260 } LDKMonitorUpdateError;
262 typedef union LDKCResultPtr_u8__MonitorUpdateError {
264 struct LDKMonitorUpdateError *err;
265 } LDKCResultPtr_u8__MonitorUpdateError;
267 typedef struct LDKCResultTempl_u8__MonitorUpdateError {
268 union LDKCResultPtr_u8__MonitorUpdateError contents;
270 } LDKCResultTempl_u8__MonitorUpdateError;
272 typedef struct LDKCResultTempl_u8__MonitorUpdateError LDKCResult_NoneMonitorUpdateErrorZ;
277 * A reference to a transaction output.
279 * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
280 * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
282 typedef struct MUST_USE_STRUCT LDKOutPoint {
284 * Nearly everywhere, inner must be non-null, however in places where
285 * the Rust equivalent takes an Option, it may be set to null to indicate None.
287 LDKnativeOutPoint *inner;
291 typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z {
292 struct LDKOutPoint a;
294 } LDKC2TupleTempl_OutPoint__CVec_u8Z;
296 typedef struct LDKC2TupleTempl_OutPoint__CVec_u8Z LDKC2Tuple_OutPointScriptZ;
298 typedef struct LDKC2TupleTempl_u32__TxOut {
301 } LDKC2TupleTempl_u32__TxOut;
303 typedef struct LDKC2TupleTempl_u32__TxOut LDKC2Tuple_u32TxOutZ;
306 * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
307 * look up the corresponding function in rust-lightning's docs.
309 typedef struct LDKThirtyTwoBytes {
313 typedef struct LDKCVecTempl_C2TupleTempl_u32__TxOut {
314 struct LDKC2TupleTempl_u32__TxOut *data;
316 } LDKCVecTempl_C2TupleTempl_u32__TxOut;
318 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut {
319 struct LDKThirtyTwoBytes a;
320 struct LDKCVecTempl_C2TupleTempl_u32__TxOut b;
321 } LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut;
323 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
325 typedef struct LDKCVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_u32TxOutZZ;
327 typedef struct LDKPublicKey {
328 uint8_t compressed_form[33];
334 * One counterparty's public keys which do not change over the life of a channel.
336 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
338 * Nearly everywhere, inner must be non-null, however in places where
339 * the Rust equivalent takes an Option, it may be set to null to indicate None.
341 LDKnativeChannelPublicKeys *inner;
343 } LDKChannelPublicKeys;
345 typedef struct LDKC2TupleTempl_u64__u64 {
348 } LDKC2TupleTempl_u64__u64;
350 typedef struct LDKC2TupleTempl_u64__u64 LDKC2Tuple_u64u64Z;
352 typedef struct LDKSignature {
353 uint8_t compact_form[64];
356 typedef struct LDKCVecTempl_Signature {
357 struct LDKSignature *data;
359 } LDKCVecTempl_Signature;
361 typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature {
362 struct LDKSignature a;
363 struct LDKCVecTempl_Signature b;
364 } LDKC2TupleTempl_Signature__CVecTempl_Signature;
366 typedef union LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 {
367 struct LDKC2TupleTempl_Signature__CVecTempl_Signature *result;
369 } LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8;
371 typedef struct LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 {
372 union LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 contents;
374 } LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8;
376 typedef struct LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
381 * This class tracks the per-transaction information needed to build a commitment transaction and to
382 * actually build it and sign. It is used for holder transactions that we sign only when needed
383 * and for transactions we sign for the counterparty.
385 * This class can be used inside a signer implementation to generate a signature given the relevant
388 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
390 * Nearly everywhere, inner must be non-null, however in places where
391 * the Rust equivalent takes an Option, it may be set to null to indicate None.
393 LDKnativeCommitmentTransaction *inner;
395 } LDKCommitmentTransaction;
400 * Information needed to build and sign a holder's commitment transaction.
402 * The transaction is only signed once we are ready to broadcast.
404 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
406 * Nearly everywhere, inner must be non-null, however in places where
407 * the Rust equivalent takes an Option, it may be set to null to indicate None.
409 LDKnativeHolderCommitmentTransaction *inner;
411 } LDKHolderCommitmentTransaction;
413 typedef union LDKCResultPtr_Signature__u8 {
414 struct LDKSignature *result;
416 } LDKCResultPtr_Signature__u8;
418 typedef struct LDKCResultTempl_Signature__u8 {
419 union LDKCResultPtr_Signature__u8 contents;
421 } LDKCResultTempl_Signature__u8;
423 typedef struct LDKCResultTempl_Signature__u8 LDKCResult_SignatureNoneZ;
428 * Information about an HTLC as it appears in a commitment transaction
430 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
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 LDKnativeHTLCOutputInCommitment *inner;
437 } LDKHTLCOutputInCommitment;
442 * The unsigned part of a channel_announcement
444 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
446 * Nearly everywhere, inner must be non-null, however in places where
447 * the Rust equivalent takes an Option, it may be set to null to indicate None.
449 LDKnativeUnsignedChannelAnnouncement *inner;
451 } LDKUnsignedChannelAnnouncement;
456 * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
457 * The fields are organized by holder/counterparty.
459 * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
460 * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
462 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
464 * Nearly everywhere, inner must be non-null, however in places where
465 * the Rust equivalent takes an Option, it may be set to null to indicate None.
467 LDKnativeChannelTransactionParameters *inner;
469 } LDKChannelTransactionParameters;
472 * Set of lightning keys needed to operate a channel as described in BOLT 3.
474 * Signing services could be implemented on a hardware wallet. In this case,
475 * the current ChannelKeys would be a front-end on top of a communication
476 * channel connected to your secure device and lightning key material wouldn't
477 * reside on a hot server. Nevertheless, a this deployment would still need
478 * to trust the ChannelManager to avoid loss of funds as this latest component
479 * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
481 * A more secure iteration would be to use hashlock (or payment points) to pair
482 * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
483 * at the price of more state and computation on the hardware wallet side. In the future,
484 * we are looking forward to design such interface.
486 * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
487 * to act, as liveness and breach reply correctness are always going to be hard requirements
488 * of LN security model, orthogonal of key management issues.
490 * If you're implementing a custom signer, you almost certainly want to implement
491 * Readable/Writable to serialize out a unique reference to this set of keys so
492 * that you can serialize the full ChannelManager object.
495 typedef struct LDKChannelKeys {
498 * Gets the per-commitment point for a specific commitment number
500 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
502 struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
504 * Gets the commitment secret for a specific commitment number as part of the revocation process
506 * An external signer implementation should error here if the commitment was already signed
507 * and should refuse to sign it in the future.
509 * May be called more than once for the same index.
511 * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
512 * TODO: return a Result so we can signal a validation error
514 struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
516 * Gets the holder's channel public keys and basepoints
518 struct LDKChannelPublicKeys pubkeys;
520 * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
521 * Note that this takes a pointer to this object, not the this_ptr like other methods do
522 * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
524 void (*set_pubkeys)(const struct LDKChannelKeys*NONNULL_PTR );
526 * Gets arbitrary identifiers describing the set of keys which are provided back to you in
527 * some SpendableOutputDescriptor types. These should be sufficient to identify this
528 * ChannelKeys object uniquely and lookup or re-derive its keys.
530 LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg);
532 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
534 * Note that if signing fails or is rejected, the channel will be force-closed.
536 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
538 * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
539 * This will only ever be called with a non-revoked commitment_tx. This will be called with the
540 * latest commitment_tx when we initiate a force-close.
541 * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
542 * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
544 * This may be called multiple times for the same transaction.
546 * An external signer implementation should check that the commitment has not been revoked.
548 * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case.
550 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
552 * Create a signature for the given input in a transaction spending an HTLC or commitment
553 * transaction output when our counterparty broadcasts an old state.
555 * A justice transaction may claim multiples outputs at the same time if timelocks are
556 * similar, but only a signature for the input at index `input` should be signed for here.
557 * It may be called multiples time for same output(s) if a fee-bump is needed with regards
558 * to an upcoming timelock expiration.
560 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
562 * per_commitment_key is revocation secret which was provided by our counterparty when they
563 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
564 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
567 * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
568 * changing the format of the witness script (which is committed to in the BIP 143
571 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);
573 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
574 * transaction, either offered or received.
576 * Such a transaction may claim multiples offered outputs at same time if we know the
577 * preimage for each when we create it, but only the input at index `input` should be
578 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
579 * needed with regards to an upcoming timelock expiration.
581 * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
584 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
586 * Per_commitment_point is the dynamic point corresponding to the channel state
587 * detected onchain. It has been generated by our counterparty and is used to derive
588 * channel state keys, which are then included in the witness script and committed to in the
591 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);
593 * Create a signature for a (proposed) closing transaction.
595 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
596 * chosen to forgo their output as dust.
598 LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
600 * Signs a channel announcement message with our funding key, proving it comes from one
601 * of the channel participants.
603 * Note that if this fails or is rejected, the channel will not be publicly announced and
604 * our counterparty may (though likely will not) close the channel on us for violating the
607 LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
609 * Set the counterparty static channel data, including basepoints,
610 * counterparty_selected/holder_selected_contest_delay and funding outpoint.
611 * This is done as soon as the funding outpoint is known. Since these are static channel data,
612 * they MUST NOT be allowed to change to different values once set.
614 * channel_parameters.is_populated() MUST be true.
616 * We bind holder_selected_contest_delay late here for API convenience.
618 * Will be called before any signatures are applied.
620 void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
621 void *(*clone)(const void *this_arg);
622 LDKCVec_u8Z (*write)(const void *this_arg);
623 void (*free)(void *this_arg);
629 * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
630 * on-chain transactions to ensure no loss of funds occurs.
632 * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
633 * information and are actively monitoring the chain.
635 * Pending Events or updated HTLCs which have not yet been read out by
636 * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
637 * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
638 * gotten are fully handled before re-serializing the new state.
640 * Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which
641 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
642 * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
643 * returned block hash and the the current chain and then reconnecting blocks to get to the
644 * best chain) upon deserializing the object!
646 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
648 * Nearly everywhere, inner must be non-null, however in places where
649 * the Rust equivalent takes an Option, it may be set to null to indicate None.
651 LDKnativeChannelMonitor *inner;
655 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor {
656 struct LDKThirtyTwoBytes a;
657 struct LDKChannelMonitor b;
658 } LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor;
660 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor LDKC2Tuple_BlockHashChannelMonitorZ;
662 typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature LDKC2Tuple_SignatureCVec_SignatureZZ;
664 typedef struct LDKCVecTempl_Signature LDKCVec_SignatureZ;
667 * A Rust str object, ie a reference to a UTF8-valid string.
668 * This is *not* null-terminated so cannot be used directly as a C string!
670 typedef struct LDKStr {
671 const uint8_t *chars;
676 * Indicates an error on the client's part (usually some variant of attempting to use too-low or
679 typedef enum LDKAPIError_Tag {
681 * Indicates the API was wholly misused (see err for more). Cases where these can be returned
682 * are documented, but generally indicates some precondition of a function was violated.
684 LDKAPIError_APIMisuseError,
686 * Due to a high feerate, we were unable to complete the request.
687 * For example, this may be returned if the feerate implies we cannot open a channel at the
688 * requested value, but opening a larger channel would succeed.
690 LDKAPIError_FeeRateTooHigh,
692 * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
693 * too-many-hops, etc).
695 LDKAPIError_RouteError,
697 * We were unable to complete the request as the Channel required to do so is unable to
698 * complete the request (or was not found). This can take many forms, including disconnected
699 * peer, channel at capacity, channel shutting down, etc.
701 LDKAPIError_ChannelUnavailable,
703 * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
704 * attempted action to fail.
706 LDKAPIError_MonitorUpdateFailed,
708 * Must be last for serialization purposes
710 LDKAPIError_Sentinel,
713 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
715 } LDKAPIError_LDKAPIMisuseError_Body;
717 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
720 } LDKAPIError_LDKFeeRateTooHigh_Body;
722 typedef struct LDKAPIError_LDKRouteError_Body {
724 } LDKAPIError_LDKRouteError_Body;
726 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
728 } LDKAPIError_LDKChannelUnavailable_Body;
730 typedef struct MUST_USE_STRUCT LDKAPIError {
733 LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
734 LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
735 LDKAPIError_LDKRouteError_Body route_error;
736 LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
740 typedef union LDKCResultPtr_u8__APIError {
742 struct LDKAPIError *err;
743 } LDKCResultPtr_u8__APIError;
745 typedef struct LDKCResultTempl_u8__APIError {
746 union LDKCResultPtr_u8__APIError contents;
748 } LDKCResultTempl_u8__APIError;
750 typedef struct LDKCResultTempl_u8__APIError LDKCResult_NoneAPIErrorZ;
755 * If a payment fails to send, it can be in one of several states. This enum is returned as the
756 * Err() type describing which state the payment is in, see the description of individual enum
759 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
761 * Nearly everywhere, inner must be non-null, however in places where
762 * the Rust equivalent takes an Option, it may be set to null to indicate None.
764 LDKnativePaymentSendFailure *inner;
766 } LDKPaymentSendFailure;
768 typedef union LDKCResultPtr_u8__PaymentSendFailure {
770 struct LDKPaymentSendFailure *err;
771 } LDKCResultPtr_u8__PaymentSendFailure;
773 typedef struct LDKCResultTempl_u8__PaymentSendFailure {
774 union LDKCResultPtr_u8__PaymentSendFailure contents;
776 } LDKCResultTempl_u8__PaymentSendFailure;
778 typedef struct LDKCResultTempl_u8__PaymentSendFailure LDKCResult_NonePaymentSendFailureZ;
783 * An update generated by the underlying Channel itself which contains some new information the
784 * ChannelMonitor should be made aware of.
786 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
788 * Nearly everywhere, inner must be non-null, however in places where
789 * the Rust equivalent takes an Option, it may be set to null to indicate None.
791 LDKnativeChannelMonitorUpdate *inner;
793 } LDKChannelMonitorUpdate;
798 * An event to be processed by the ChannelManager.
800 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
802 * Nearly everywhere, inner must be non-null, however in places where
803 * the Rust equivalent takes an Option, it may be set to null to indicate None.
805 LDKnativeMonitorEvent *inner;
809 typedef struct LDKCVecTempl_MonitorEvent {
810 struct LDKMonitorEvent *data;
812 } LDKCVecTempl_MonitorEvent;
814 typedef struct LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ;
817 * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
818 * blocks are connected and disconnected.
820 * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
821 * responsible for maintaining a set of monitors such that they can be updated accordingly as
822 * channel state changes and HTLCs are resolved. See method documentation for specific
825 * Implementations **must** ensure that updates are successfully applied and persisted upon method
826 * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
827 * without taking any further action such as persisting the current state.
829 * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
830 * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
831 * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
832 * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
833 * multiple instances.
835 * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html
836 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
837 * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure
839 typedef struct LDKWatch {
842 * Watches a channel identified by `funding_txo` using `monitor`.
844 * Implementations are responsible for watching the chain for the funding transaction along
845 * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
846 * calling [`block_connected`] and [`block_disconnected`] on the monitor.
848 * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
849 * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected
850 * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
852 LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
854 * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
856 * Implementations must call [`update_monitor`] with the given update. See
857 * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
859 * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor
860 * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html
862 LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
864 * Returns any monitor events since the last call. Subsequent calls must only return new
867 LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
868 void (*free)(void *this_arg);
872 * An interface to send a transaction to the Bitcoin network.
874 typedef struct LDKBroadcasterInterface {
877 * Sends a transaction out to (hopefully) be mined.
879 void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
880 void (*free)(void *this_arg);
881 } LDKBroadcasterInterface;
883 typedef struct LDKSecretKey {
890 * An error in decoding a message or struct.
892 typedef struct MUST_USE_STRUCT LDKDecodeError {
894 * Nearly everywhere, inner must be non-null, however in places where
895 * the Rust equivalent takes an Option, it may be set to null to indicate None.
897 LDKnativeDecodeError *inner;
901 typedef union LDKCResultPtr_ChannelKeys__DecodeError {
902 struct LDKChannelKeys *result;
903 struct LDKDecodeError *err;
904 } LDKCResultPtr_ChannelKeys__DecodeError;
906 typedef struct LDKCResultTempl_ChannelKeys__DecodeError {
907 union LDKCResultPtr_ChannelKeys__DecodeError contents;
909 } LDKCResultTempl_ChannelKeys__DecodeError;
911 typedef struct LDKCResultTempl_ChannelKeys__DecodeError LDKCResult_ChanKeySignerDecodeErrorZ;
913 typedef struct LDKu8slice {
919 * A trait to describe an object which can get user secrets and key material.
921 typedef struct LDKKeysInterface {
924 * Get node secret key (aka node_id or network_key)
926 struct LDKSecretKey (*get_node_secret)(const void *this_arg);
928 * Get destination redeemScript to encumber static protocol exit points.
930 LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
932 * Get shutdown_pubkey to use as PublicKey at channel closure
934 struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
936 * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
937 * restarted with some stale data!
939 struct LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
941 * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
942 * onion packets and for temporary channel IDs. There is no requirement that these be
943 * persisted anywhere, though they must be unique across restarts.
945 struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
947 * Reads a `ChanKeySigner` for this `KeysInterface` from the given input stream.
948 * This is only called during deserialization of other objects which contain
949 * `ChannelKeys`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
950 * The bytes are exactly those which `<Self::ChanKeySigner as Writeable>::write()` writes, and
951 * contain no versioning scheme. You may wish to include your own version prefix and ensure
952 * you've read all of the provided bytes to ensure no corruption occurred.
954 LDKCResult_ChanKeySignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
955 void (*free)(void *this_arg);
959 * A trait which should be implemented to provide feerate information on a number of time
962 * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
963 * called from inside the library in response to chain events, P2P events, or timer events).
965 typedef struct LDKFeeEstimator {
968 * Gets estimated satoshis of fee required per 1000 Weight-Units.
970 * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
971 * don't put us below 1 satoshi-per-byte).
973 * This translates to:
974 * * satoshis-per-byte * 250
975 * * ceil(satoshis-per-kbyte / 4)
977 uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
978 void (*free)(void *this_arg);
982 * A trait encapsulating the operations required of a logger
984 typedef struct LDKLogger {
989 void (*log)(const void *this_arg, const char *record);
990 void (*free)(void *this_arg);
996 * Manager which keeps track of a number of channels and sends messages to the appropriate
997 * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
999 * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
1000 * to individual Channels.
1002 * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
1003 * all peers during write/read (though does not modify this instance, only the instance being
1004 * serialized). This will result in any channels which have not yet exchanged funding_created (ie
1005 * called funding_transaction_generated for outbound channels).
1007 * Note that you can be a bit lazier about writing out ChannelManager than you can be with
1008 * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
1009 * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
1010 * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
1011 * the serialization process). If the deserialized version is out-of-date compared to the
1012 * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
1013 * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
1015 * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which
1016 * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
1017 * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
1018 * block_connected() to step towards your best block) upon deserialization before using the
1021 * Note that ChannelManager is responsible for tracking liveness of its channels and generating
1022 * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
1023 * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
1024 * offline for a full minute. In order to track this, you must call
1025 * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect.
1027 * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
1028 * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
1029 * essentially you should default to using a SimpleRefChannelManager, and use a
1030 * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
1031 * you're using lightning-net-tokio.
1033 typedef struct MUST_USE_STRUCT LDKChannelManager {
1035 * Nearly everywhere, inner must be non-null, however in places where
1036 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1038 LDKnativeChannelManager *inner;
1040 } LDKChannelManager;
1042 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager {
1043 struct LDKThirtyTwoBytes a;
1044 struct LDKChannelManager b;
1045 } LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager;
1047 typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager LDKC2Tuple_BlockHashChannelManagerZ;
1052 * A channel_announcement message to be sent or received from a peer
1054 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
1056 * Nearly everywhere, inner must be non-null, however in places where
1057 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1059 LDKnativeChannelAnnouncement *inner;
1061 } LDKChannelAnnouncement;
1066 * A channel_update message to be sent or received from a peer
1068 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
1070 * Nearly everywhere, inner must be non-null, however in places where
1071 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1073 LDKnativeChannelUpdate *inner;
1077 typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
1078 struct LDKChannelAnnouncement a;
1079 struct LDKChannelUpdate b;
1080 struct LDKChannelUpdate c;
1081 } LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
1083 typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
1088 * An Err type for failure to process messages.
1090 typedef struct MUST_USE_STRUCT LDKLightningError {
1092 * Nearly everywhere, inner must be non-null, however in places where
1093 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1095 LDKnativeLightningError *inner;
1097 } LDKLightningError;
1099 typedef union LDKCResultPtr_u8__LightningError {
1101 struct LDKLightningError *err;
1102 } LDKCResultPtr_u8__LightningError;
1104 typedef struct LDKCResultTempl_u8__LightningError {
1105 union LDKCResultPtr_u8__LightningError contents;
1107 } LDKCResultTempl_u8__LightningError;
1109 typedef struct LDKCResultTempl_u8__LightningError LDKCResult_NoneLightningErrorZ;
1114 * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
1115 * generate no further read_event/write_buffer_space_avail calls for the descriptor, only
1116 * triggering a single socket_disconnected call (unless it was provided in response to a
1117 * new_*_connection event, in which case no such socket_disconnected() must be called and the
1118 * socket silently disconencted).
1120 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
1122 * Nearly everywhere, inner must be non-null, however in places where
1123 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1125 LDKnativePeerHandleError *inner;
1127 } LDKPeerHandleError;
1129 typedef union LDKCResultPtr_u8__PeerHandleError {
1131 struct LDKPeerHandleError *err;
1132 } LDKCResultPtr_u8__PeerHandleError;
1134 typedef struct LDKCResultTempl_u8__PeerHandleError {
1135 union LDKCResultPtr_u8__PeerHandleError contents;
1137 } LDKCResultTempl_u8__PeerHandleError;
1139 typedef struct LDKCResultTempl_u8__PeerHandleError LDKCResult_NonePeerHandleErrorZ;
1144 * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1145 * transaction and the transaction creation keys) are trusted.
1147 * See trust() and verify() functions on CommitmentTransaction.
1149 * This structure implements Deref.
1151 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1153 * Nearly everywhere, inner must be non-null, however in places where
1154 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1156 LDKnativeTrustedCommitmentTransaction *inner;
1158 } LDKTrustedCommitmentTransaction;
1160 typedef union LDKCResultPtr_TrustedCommitmentTransaction__u8 {
1161 struct LDKTrustedCommitmentTransaction *result;
1163 } LDKCResultPtr_TrustedCommitmentTransaction__u8;
1165 typedef struct LDKCResultTempl_TrustedCommitmentTransaction__u8 {
1166 union LDKCResultPtr_TrustedCommitmentTransaction__u8 contents;
1168 } LDKCResultTempl_TrustedCommitmentTransaction__u8;
1170 typedef struct LDKCResultTempl_TrustedCommitmentTransaction__u8 LDKCResult_TrustedCommitmentTransactionNoneZ;
1172 typedef union LDKCResultPtr_CVecTempl_Signature_____u8 {
1173 struct LDKCVecTempl_Signature *result;
1175 } LDKCResultPtr_CVecTempl_Signature_____u8;
1177 typedef struct LDKCResultTempl_CVecTempl_Signature_____u8 {
1178 union LDKCResultPtr_CVecTempl_Signature_____u8 contents;
1180 } LDKCResultTempl_CVecTempl_Signature_____u8;
1182 typedef struct LDKCResultTempl_CVecTempl_Signature_____u8 LDKCResult_CVec_SignatureZNoneZ;
1185 * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
1186 * claim at any point in the future) an event is generated which you must track and be able to
1187 * spend on-chain. The information needed to do this is provided in this enum, including the
1188 * outpoint describing which txid and output index is available, the full output which exists at
1189 * that txid/index, and any keys or other information required to sign.
1191 typedef enum LDKSpendableOutputDescriptor_Tag {
1193 * An output to a script which was provided via KeysInterface, thus you should already know
1194 * how to spend it. No keys are provided as rust-lightning was never given any keys - only the
1195 * script_pubkey as it appears in the output.
1196 * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
1197 * on-chain using the payment preimage or after it has timed out.
1199 LDKSpendableOutputDescriptor_StaticOutput,
1201 * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
1203 * The witness in the spending input should be:
1204 * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
1206 * Note that the nSequence field in the spending input must be set to to_self_delay
1207 * (which means the transaction is not broadcastable until at least to_self_delay
1208 * blocks after the outpoint confirms).
1210 * These are generally the result of a \"revocable\" output to us, spendable only by us unless
1211 * it is an output from an old state which we broadcast (which should never happen).
1213 * To derive the delayed_payment key which is used to sign for this input, you must pass the
1214 * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
1215 * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
1216 * chan_utils::derive_private_key. The public key can be generated without the secret key
1217 * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
1218 * ChannelKeys::pubkeys().
1220 * To derive the revocation_pubkey provided here (which is used in the witness
1221 * script generation), you must pass the counterparty revocation_basepoint (which appears in the
1222 * call to ChannelKeys::ready_channel) and the provided per_commitment point
1223 * to chan_utils::derive_public_revocation_key.
1225 * The witness script which is hashed and included in the output script_pubkey may be
1226 * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
1227 * (derived as above), and the to_self_delay contained here to
1228 * chan_utils::get_revokeable_redeemscript.
1230 LDKSpendableOutputDescriptor_DynamicOutputP2WSH,
1232 * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
1233 * corresponds to the public key in ChannelKeys::pubkeys().payment_point).
1234 * The witness in the spending input, is, thus, simply:
1235 * <BIP 143 signature> <payment key>
1237 * These are generally the result of our counterparty having broadcast the current state,
1238 * allowing us to claim the non-HTLC-encumbered outputs immediately.
1240 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment,
1242 * Must be last for serialization purposes
1244 LDKSpendableOutputDescriptor_Sentinel,
1245 } LDKSpendableOutputDescriptor_Tag;
1247 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
1248 struct LDKOutPoint outpoint;
1249 struct LDKTxOut output;
1250 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
1252 typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body {
1253 struct LDKOutPoint outpoint;
1254 struct LDKPublicKey per_commitment_point;
1255 uint16_t to_self_delay;
1256 struct LDKTxOut output;
1257 LDKC2Tuple_u64u64Z key_derivation_params;
1258 struct LDKPublicKey revocation_pubkey;
1259 } LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body;
1261 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body {
1262 struct LDKOutPoint outpoint;
1263 struct LDKTxOut output;
1264 LDKC2Tuple_u64u64Z key_derivation_params;
1265 } LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body;
1267 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
1268 LDKSpendableOutputDescriptor_Tag tag;
1270 LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
1271 LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh;
1272 LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment;
1274 } LDKSpendableOutputDescriptor;
1276 typedef struct LDKCVecTempl_SpendableOutputDescriptor {
1277 struct LDKSpendableOutputDescriptor *data;
1279 } LDKCVecTempl_SpendableOutputDescriptor;
1281 typedef struct LDKCVecTempl_SpendableOutputDescriptor LDKCVec_SpendableOutputDescriptorZ;
1284 * An Event which you should probably take some action in response to.
1286 * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
1287 * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
1288 * written as it makes no sense to respond to it after reconnecting to peers).
1290 typedef enum LDKEvent_Tag {
1292 * Used to indicate that the client should generate a funding transaction with the given
1293 * parameters and then call ChannelManager::funding_transaction_generated.
1294 * Generated in ChannelManager message handling.
1295 * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
1296 * counterparty can steal your funds!
1298 LDKEvent_FundingGenerationReady,
1300 * Used to indicate that the client may now broadcast the funding transaction it created for a
1301 * channel. Broadcasting such a transaction prior to this event may lead to our counterparty
1302 * trivially stealing all funds in the funding transaction!
1304 LDKEvent_FundingBroadcastSafe,
1306 * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
1307 * ChannelManager::claim_funds to get it....
1308 * Note that if the preimage is not known or the amount paid is incorrect, you should call
1309 * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
1310 * network congestion.
1311 * The amount paid should be considered 'incorrect' when it is less than or more than twice
1312 * the amount expected.
1313 * If you fail to call either ChannelManager::claim_funds or
1314 * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
1315 * automatically failed.
1317 LDKEvent_PaymentReceived,
1319 * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
1320 * and we got back the payment preimage for it).
1321 * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
1322 * deduplicate them by payment_preimage (which MUST be unique)!
1324 LDKEvent_PaymentSent,
1326 * Indicates an outbound payment we made failed. Probably some intermediary node dropped
1327 * something. You may wish to retry with a different route.
1328 * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
1329 * deduplicate them by payment_hash (which MUST be unique)!
1331 LDKEvent_PaymentFailed,
1333 * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
1334 * time in the future.
1336 LDKEvent_PendingHTLCsForwardable,
1338 * Used to indicate that an output was generated on-chain which you should know how to spend.
1339 * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
1340 * counterparty spending them due to some kind of timeout. Thus, you need to store them
1341 * somewhere and spend them when you create on-chain transactions.
1343 LDKEvent_SpendableOutputs,
1345 * Must be last for serialization purposes
1350 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
1351 struct LDKThirtyTwoBytes temporary_channel_id;
1352 uint64_t channel_value_satoshis;
1353 LDKCVec_u8Z output_script;
1354 uint64_t user_channel_id;
1355 } LDKEvent_LDKFundingGenerationReady_Body;
1357 typedef struct LDKEvent_LDKFundingBroadcastSafe_Body {
1358 struct LDKOutPoint funding_txo;
1359 uint64_t user_channel_id;
1360 } LDKEvent_LDKFundingBroadcastSafe_Body;
1362 typedef struct LDKEvent_LDKPaymentReceived_Body {
1363 struct LDKThirtyTwoBytes payment_hash;
1364 struct LDKThirtyTwoBytes payment_secret;
1366 } LDKEvent_LDKPaymentReceived_Body;
1368 typedef struct LDKEvent_LDKPaymentSent_Body {
1369 struct LDKThirtyTwoBytes payment_preimage;
1370 } LDKEvent_LDKPaymentSent_Body;
1372 typedef struct LDKEvent_LDKPaymentFailed_Body {
1373 struct LDKThirtyTwoBytes payment_hash;
1374 bool rejected_by_dest;
1375 } LDKEvent_LDKPaymentFailed_Body;
1377 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
1378 uint64_t time_forwardable;
1379 } LDKEvent_LDKPendingHTLCsForwardable_Body;
1381 typedef struct LDKEvent_LDKSpendableOutputs_Body {
1382 LDKCVec_SpendableOutputDescriptorZ outputs;
1383 } LDKEvent_LDKSpendableOutputs_Body;
1385 typedef struct MUST_USE_STRUCT LDKEvent {
1388 LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
1389 LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe;
1390 LDKEvent_LDKPaymentReceived_Body payment_received;
1391 LDKEvent_LDKPaymentSent_Body payment_sent;
1392 LDKEvent_LDKPaymentFailed_Body payment_failed;
1393 LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
1394 LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
1401 * An accept_channel message to be sent or received from a peer
1403 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
1405 * Nearly everywhere, inner must be non-null, however in places where
1406 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1408 LDKnativeAcceptChannel *inner;
1415 * An open_channel message to be sent or received from a peer
1417 typedef struct MUST_USE_STRUCT LDKOpenChannel {
1419 * Nearly everywhere, inner must be non-null, however in places where
1420 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1422 LDKnativeOpenChannel *inner;
1429 * A funding_created message to be sent or received from a peer
1431 typedef struct MUST_USE_STRUCT LDKFundingCreated {
1433 * Nearly everywhere, inner must be non-null, however in places where
1434 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1436 LDKnativeFundingCreated *inner;
1438 } LDKFundingCreated;
1443 * A funding_signed message to be sent or received from a peer
1445 typedef struct MUST_USE_STRUCT LDKFundingSigned {
1447 * Nearly everywhere, inner must be non-null, however in places where
1448 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1450 LDKnativeFundingSigned *inner;
1457 * A funding_locked message to be sent or received from a peer
1459 typedef struct MUST_USE_STRUCT LDKFundingLocked {
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 LDKnativeFundingLocked *inner;
1471 * An announcement_signatures message to be sent or received from a peer
1473 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
1475 * Nearly everywhere, inner must be non-null, however in places where
1476 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1478 LDKnativeAnnouncementSignatures *inner;
1480 } LDKAnnouncementSignatures;
1485 * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
1486 * transaction updates if they were pending.
1488 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
1490 * Nearly everywhere, inner must be non-null, however in places where
1491 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1493 LDKnativeCommitmentUpdate *inner;
1495 } LDKCommitmentUpdate;
1500 * A revoke_and_ack message to be sent or received from a peer
1502 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
1504 * Nearly everywhere, inner must be non-null, however in places where
1505 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1507 LDKnativeRevokeAndACK *inner;
1514 * A closing_signed message to be sent or received from a peer
1516 typedef struct MUST_USE_STRUCT LDKClosingSigned {
1518 * Nearly everywhere, inner must be non-null, however in places where
1519 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1521 LDKnativeClosingSigned *inner;
1528 * A shutdown message to be sent or received from a peer
1530 typedef struct MUST_USE_STRUCT LDKShutdown {
1532 * Nearly everywhere, inner must be non-null, however in places where
1533 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1535 LDKnativeShutdown *inner;
1542 * A channel_reestablish message to be sent or received from a peer
1544 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
1546 * Nearly everywhere, inner must be non-null, however in places where
1547 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1549 LDKnativeChannelReestablish *inner;
1551 } LDKChannelReestablish;
1556 * A node_announcement message to be sent or received from a peer
1558 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
1560 * Nearly everywhere, inner must be non-null, however in places where
1561 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1563 LDKnativeNodeAnnouncement *inner;
1565 } LDKNodeAnnouncement;
1570 * An error message to be sent or received from a peer
1572 typedef struct MUST_USE_STRUCT LDKErrorMessage {
1574 * Nearly everywhere, inner must be non-null, however in places where
1575 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1577 LDKnativeErrorMessage *inner;
1582 * Used to put an error message in a LightningError
1584 typedef enum LDKErrorAction_Tag {
1586 * The peer took some action which made us think they were useless. Disconnect them.
1588 LDKErrorAction_DisconnectPeer,
1590 * The peer did something harmless that we weren't able to process, just log and ignore
1592 LDKErrorAction_IgnoreError,
1594 * The peer did something incorrect. Tell them.
1596 LDKErrorAction_SendErrorMessage,
1598 * Must be last for serialization purposes
1600 LDKErrorAction_Sentinel,
1601 } LDKErrorAction_Tag;
1603 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
1604 struct LDKErrorMessage msg;
1605 } LDKErrorAction_LDKDisconnectPeer_Body;
1607 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
1608 struct LDKErrorMessage msg;
1609 } LDKErrorAction_LDKSendErrorMessage_Body;
1611 typedef struct MUST_USE_STRUCT LDKErrorAction {
1612 LDKErrorAction_Tag tag;
1614 LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
1615 LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
1620 * The information we received from a peer along the route of a payment we originated. This is
1621 * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
1622 * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
1624 typedef enum LDKHTLCFailChannelUpdate_Tag {
1626 * We received an error which included a full ChannelUpdate message.
1628 LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
1630 * We received an error which indicated only that a channel has been closed
1632 LDKHTLCFailChannelUpdate_ChannelClosed,
1634 * We received an error which indicated only that a node has failed
1636 LDKHTLCFailChannelUpdate_NodeFailure,
1638 * Must be last for serialization purposes
1640 LDKHTLCFailChannelUpdate_Sentinel,
1641 } LDKHTLCFailChannelUpdate_Tag;
1643 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
1644 struct LDKChannelUpdate msg;
1645 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
1647 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
1648 uint64_t short_channel_id;
1650 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
1652 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
1653 struct LDKPublicKey node_id;
1655 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
1657 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
1658 LDKHTLCFailChannelUpdate_Tag tag;
1660 LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
1661 LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
1662 LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
1664 } LDKHTLCFailChannelUpdate;
1669 * A query_channel_range message is used to query a peer for channel
1670 * UTXOs in a range of blocks. The recipient of a query makes a best
1671 * effort to reply to the query using one or more reply_channel_range
1674 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
1676 * Nearly everywhere, inner must be non-null, however in places where
1677 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1679 LDKnativeQueryChannelRange *inner;
1681 } LDKQueryChannelRange;
1686 * A query_short_channel_ids message is used to query a peer for
1687 * routing gossip messages related to one or more short_channel_ids.
1688 * The query recipient will reply with the latest, if available,
1689 * channel_announcement, channel_update and node_announcement messages
1690 * it maintains for the requested short_channel_ids followed by a
1691 * reply_short_channel_ids_end message. The short_channel_ids sent in
1692 * this query are encoded. We only support encoding_type=0 uncompressed
1693 * serialization and do not support encoding_type=1 zlib serialization.
1695 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
1697 * Nearly everywhere, inner must be non-null, however in places where
1698 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1700 LDKnativeQueryShortChannelIds *inner;
1702 } LDKQueryShortChannelIds;
1705 * An event generated by ChannelManager which indicates a message should be sent to a peer (or
1706 * broadcast to most peers).
1707 * These events are handled by PeerManager::process_events if you are using a PeerManager.
1709 typedef enum LDKMessageSendEvent_Tag {
1711 * Used to indicate that we've accepted a channel open and should send the accept_channel
1712 * message provided to the given peer.
1714 LDKMessageSendEvent_SendAcceptChannel,
1716 * Used to indicate that we've initiated a channel open and should send the open_channel
1717 * message provided to the given peer.
1719 LDKMessageSendEvent_SendOpenChannel,
1721 * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
1723 LDKMessageSendEvent_SendFundingCreated,
1725 * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
1727 LDKMessageSendEvent_SendFundingSigned,
1729 * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
1731 LDKMessageSendEvent_SendFundingLocked,
1733 * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
1735 LDKMessageSendEvent_SendAnnouncementSignatures,
1737 * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
1738 * message should be sent to the peer with the given node_id.
1740 LDKMessageSendEvent_UpdateHTLCs,
1742 * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
1744 LDKMessageSendEvent_SendRevokeAndACK,
1746 * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
1748 LDKMessageSendEvent_SendClosingSigned,
1750 * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
1752 LDKMessageSendEvent_SendShutdown,
1754 * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
1756 LDKMessageSendEvent_SendChannelReestablish,
1758 * Used to indicate that a channel_announcement and channel_update should be broadcast to all
1759 * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
1761 * Note that after doing so, you very likely (unless you did so very recently) want to call
1762 * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
1763 * This ensures that any nodes which see our channel_announcement also have a relevant
1764 * node_announcement, including relevant feature flags which may be important for routing
1767 LDKMessageSendEvent_BroadcastChannelAnnouncement,
1769 * Used to indicate that a node_announcement should be broadcast to all peers.
1771 LDKMessageSendEvent_BroadcastNodeAnnouncement,
1773 * Used to indicate that a channel_update should be broadcast to all peers.
1775 LDKMessageSendEvent_BroadcastChannelUpdate,
1777 * Broadcast an error downstream to be handled
1779 LDKMessageSendEvent_HandleError,
1781 * When a payment fails we may receive updates back from the hop where it failed. In such
1782 * cases this event is generated so that we can inform the network graph of this information.
1784 LDKMessageSendEvent_PaymentFailureNetworkUpdate,
1786 * Query a peer for channels with funding transaction UTXOs in a block range.
1788 LDKMessageSendEvent_SendChannelRangeQuery,
1790 * Request routing gossip messages from a peer for a list of channels identified by
1791 * their short_channel_ids.
1793 LDKMessageSendEvent_SendShortIdsQuery,
1795 * Must be last for serialization purposes
1797 LDKMessageSendEvent_Sentinel,
1798 } LDKMessageSendEvent_Tag;
1800 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
1801 struct LDKPublicKey node_id;
1802 struct LDKAcceptChannel msg;
1803 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
1805 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
1806 struct LDKPublicKey node_id;
1807 struct LDKOpenChannel msg;
1808 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
1810 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
1811 struct LDKPublicKey node_id;
1812 struct LDKFundingCreated msg;
1813 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
1815 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
1816 struct LDKPublicKey node_id;
1817 struct LDKFundingSigned msg;
1818 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
1820 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
1821 struct LDKPublicKey node_id;
1822 struct LDKFundingLocked msg;
1823 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
1825 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
1826 struct LDKPublicKey node_id;
1827 struct LDKAnnouncementSignatures msg;
1828 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
1830 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
1831 struct LDKPublicKey node_id;
1832 struct LDKCommitmentUpdate updates;
1833 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
1835 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
1836 struct LDKPublicKey node_id;
1837 struct LDKRevokeAndACK msg;
1838 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
1840 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
1841 struct LDKPublicKey node_id;
1842 struct LDKClosingSigned msg;
1843 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
1845 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
1846 struct LDKPublicKey node_id;
1847 struct LDKShutdown msg;
1848 } LDKMessageSendEvent_LDKSendShutdown_Body;
1850 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
1851 struct LDKPublicKey node_id;
1852 struct LDKChannelReestablish msg;
1853 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
1855 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
1856 struct LDKChannelAnnouncement msg;
1857 struct LDKChannelUpdate update_msg;
1858 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
1860 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
1861 struct LDKNodeAnnouncement msg;
1862 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
1864 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
1865 struct LDKChannelUpdate msg;
1866 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
1868 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
1869 struct LDKPublicKey node_id;
1870 struct LDKErrorAction action;
1871 } LDKMessageSendEvent_LDKHandleError_Body;
1873 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
1874 struct LDKHTLCFailChannelUpdate update;
1875 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
1877 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
1878 struct LDKPublicKey node_id;
1879 struct LDKQueryChannelRange msg;
1880 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
1882 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
1883 struct LDKPublicKey node_id;
1884 struct LDKQueryShortChannelIds msg;
1885 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
1887 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
1888 LDKMessageSendEvent_Tag tag;
1890 LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
1891 LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
1892 LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
1893 LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
1894 LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
1895 LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
1896 LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
1897 LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
1898 LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
1899 LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
1900 LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
1901 LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
1902 LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
1903 LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
1904 LDKMessageSendEvent_LDKHandleError_Body handle_error;
1905 LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
1906 LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
1907 LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
1909 } LDKMessageSendEvent;
1911 typedef struct LDKCVecTempl_MessageSendEvent {
1912 struct LDKMessageSendEvent *data;
1914 } LDKCVecTempl_MessageSendEvent;
1916 typedef struct LDKCVecTempl_MessageSendEvent LDKCVec_MessageSendEventZ;
1919 * A trait indicating an object may generate message send events
1921 typedef struct LDKMessageSendEventsProvider {
1924 * Gets the list of pending events which were generated by previous actions, clearing the list
1927 LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
1928 void (*free)(void *this_arg);
1929 } LDKMessageSendEventsProvider;
1931 typedef struct LDKCVecTempl_Event {
1932 struct LDKEvent *data;
1934 } LDKCVecTempl_Event;
1936 typedef struct LDKCVecTempl_Event LDKCVec_EventZ;
1939 * A trait indicating an object may generate events
1941 typedef struct LDKEventsProvider {
1944 * Gets the list of pending events which were generated by previous actions, clearing the list
1947 LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
1948 void (*free)(void *this_arg);
1949 } LDKEventsProvider;
1954 * Configuration we set when applicable.
1956 * Default::default() provides sane defaults.
1958 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
1960 * Nearly everywhere, inner must be non-null, however in places where
1961 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1963 LDKnativeChannelHandshakeConfig *inner;
1965 } LDKChannelHandshakeConfig;
1970 * Optional channel limits which are applied during channel creation.
1972 * These limits are only applied to our counterparty's limits, not our own.
1974 * Use 0/<type>::max_value() as appropriate to skip checking.
1976 * Provides sane defaults for most configurations.
1978 * Most additional limits are disabled except those with which specify a default in individual
1979 * field documentation. Note that this may result in barely-usable channels, but since they
1980 * are applied mostly only to incoming channels that's not much of a problem.
1982 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
1984 * Nearly everywhere, inner must be non-null, however in places where
1985 * the Rust equivalent takes an Option, it may be set to null to indicate None.
1987 LDKnativeChannelHandshakeLimits *inner;
1989 } LDKChannelHandshakeLimits;
1994 * Options which apply on a per-channel basis and may change at runtime or based on negotiation
1995 * with our counterparty.
1997 typedef struct MUST_USE_STRUCT LDKChannelConfig {
1999 * Nearly everywhere, inner must be non-null, however in places where
2000 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2002 LDKnativeChannelConfig *inner;
2009 * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
2011 * Default::default() provides sane defaults for most configurations
2012 * (but currently with 0 relay fees!)
2014 typedef struct MUST_USE_STRUCT LDKUserConfig {
2016 * Nearly everywhere, inner must be non-null, however in places where
2017 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2019 LDKnativeUserConfig *inner;
2023 typedef union LDKCResultPtr_TxOut__AccessError {
2024 struct LDKTxOut *result;
2025 enum LDKAccessError *err;
2026 } LDKCResultPtr_TxOut__AccessError;
2028 typedef struct LDKCResultTempl_TxOut__AccessError {
2029 union LDKCResultPtr_TxOut__AccessError contents;
2031 } LDKCResultTempl_TxOut__AccessError;
2033 typedef struct LDKCResultTempl_TxOut__AccessError LDKCResult_TxOutAccessErrorZ;
2036 * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
2039 typedef struct LDKAccess {
2042 * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
2043 * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
2046 * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
2048 LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
2049 void (*free)(void *this_arg);
2053 * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
2056 * This is useful in order to have a [`Watch`] implementation convey to a chain source which
2057 * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
2058 * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
2059 * receiving full blocks from a chain source, any further filtering is unnecessary.
2061 * After an output has been registered, subsequent block retrievals from the chain source must not
2062 * exclude any transactions matching the new criteria nor any in-block descendants of such
2065 * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
2066 * should not block on I/O. Implementations should instead queue the newly monitored data to be
2067 * processed later. Then, in order to block until the data has been processed, any `Watch`
2068 * invocation that has called the `Filter` must return [`TemporaryFailure`].
2070 * [`Watch`]: trait.Watch.html
2071 * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure
2072 * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
2073 * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
2075 typedef struct LDKFilter {
2078 * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
2079 * a spending condition.
2081 void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
2083 * Registers interest in spends of a transaction output identified by `outpoint` having
2084 * `script_pubkey` as the spending condition.
2086 void (*register_output)(const void *this_arg, const struct LDKOutPoint *NONNULL_PTR outpoint, struct LDKu8slice script_pubkey);
2087 void (*free)(void *this_arg);
2091 * `Persist` defines behavior for persisting channel monitors: this could mean
2092 * writing once to disk, and/or uploading to one or more backup services.
2094 * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
2095 * to disk/backups. And, on every update, you **must** persist either the
2096 * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
2097 * of situations such as revoking a transaction, then crashing before this
2098 * revocation can be persisted, then unintentionally broadcasting a revoked
2099 * transaction and losing money. This is a risk because previous channel states
2100 * are toxic, so it's important that whatever channel state is persisted is
2103 typedef struct LDKPersist {
2106 * Persist a new channel's data. The data can be stored any way you want, but
2107 * the identifier provided by Rust-Lightning is the channel's outpoint (and
2108 * it is up to you to maintain a correct mapping between the outpoint and the
2109 * stored channel data). Note that you **must** persist every new monitor to
2110 * disk. See the `Persist` trait documentation for more details.
2112 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
2113 * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
2115 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
2116 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
2118 LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
2120 * Update one channel's data. The provided `ChannelMonitor` has already
2121 * applied the given update.
2123 * Note that on every update, you **must** persist either the
2124 * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
2125 * the `Persist` trait documentation for more details.
2127 * If an implementer chooses to persist the updates only, they need to make
2128 * sure that all the updates are applied to the `ChannelMonitors` *before*
2129 * the set of channel monitors is given to the `ChannelManager`
2130 * deserialization routine. See [`ChannelMonitor::update_monitor`] for
2131 * applying a monitor update to a monitor. If full `ChannelMonitors` are
2132 * persisted, then there is no need to persist individual updates.
2134 * Note that there could be a performance tradeoff between persisting complete
2135 * channel monitors on every update vs. persisting only updates and applying
2136 * them in batches. The size of each monitor grows `O(number of state updates)`
2137 * whereas updates are small and `O(1)`.
2139 * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`,
2140 * [`ChannelMonitorUpdate::write`] for writing out an update, and
2141 * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
2143 * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1
2144 * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk
2145 * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write
2146 * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html
2148 LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data);
2149 void (*free)(void *this_arg);
2155 * An implementation of [`chain::Watch`] for monitoring channels.
2157 * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
2158 * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
2159 * or used independently to monitor channels remotely. See the [module-level documentation] for
2162 * [`chain::Watch`]: ../trait.Watch.html
2163 * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html
2164 * [module-level documentation]: index.html
2166 typedef struct MUST_USE_STRUCT LDKChainMonitor {
2168 * Nearly everywhere, inner must be non-null, however in places where
2169 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2171 LDKnativeChainMonitor *inner;
2175 typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction {
2176 struct LDKC2TupleTempl_usize__Transaction *data;
2178 } LDKCVecTempl_C2TupleTempl_usize__Transaction;
2180 typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction LDKCVec_C2Tuple_usizeTransactionZZ;
2182 typedef union LDKCResultPtr_ChannelMonitorUpdate__DecodeError {
2183 struct LDKChannelMonitorUpdate *result;
2184 struct LDKDecodeError *err;
2185 } LDKCResultPtr_ChannelMonitorUpdate__DecodeError;
2187 typedef struct LDKCResultTempl_ChannelMonitorUpdate__DecodeError {
2188 union LDKCResultPtr_ChannelMonitorUpdate__DecodeError contents;
2190 } LDKCResultTempl_ChannelMonitorUpdate__DecodeError;
2192 typedef struct LDKCResultTempl_ChannelMonitorUpdate__DecodeError LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
2197 * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2198 * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2199 * preimage claim backward will lead to loss of funds.
2201 * [`chain::Watch`]: ../trait.Watch.html
2203 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2205 * Nearly everywhere, inner must be non-null, however in places where
2206 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2208 LDKnativeHTLCUpdate *inner;
2212 typedef struct LDKCVecTempl_Transaction {
2213 struct LDKTransaction *data;
2215 } LDKCVecTempl_Transaction;
2217 typedef struct LDKCVecTempl_Transaction LDKCVec_TransactionZ;
2219 typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut {
2220 struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut *data;
2222 } LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut;
2224 typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ;
2226 typedef union LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError {
2227 struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor *result;
2228 struct LDKDecodeError *err;
2229 } LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError;
2231 typedef struct LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError {
2232 union LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError contents;
2234 } LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError;
2236 typedef struct LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
2238 typedef union LDKCResultPtr_SpendableOutputDescriptor__DecodeError {
2239 struct LDKSpendableOutputDescriptor *result;
2240 struct LDKDecodeError *err;
2241 } LDKCResultPtr_SpendableOutputDescriptor__DecodeError;
2243 typedef struct LDKCResultTempl_SpendableOutputDescriptor__DecodeError {
2244 union LDKCResultPtr_SpendableOutputDescriptor__DecodeError contents;
2246 } LDKCResultTempl_SpendableOutputDescriptor__DecodeError;
2248 typedef struct LDKCResultTempl_SpendableOutputDescriptor__DecodeError LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
2253 * A simple implementation of ChannelKeys that just keeps the private keys in memory.
2255 * This implementation performs no policy checks and is insufficient by itself as
2256 * a secure external signer.
2258 typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys {
2260 * Nearly everywhere, inner must be non-null, however in places where
2261 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2263 LDKnativeInMemoryChannelKeys *inner;
2265 } LDKInMemoryChannelKeys;
2267 typedef union LDKCResultPtr_InMemoryChannelKeys__DecodeError {
2268 struct LDKInMemoryChannelKeys *result;
2269 struct LDKDecodeError *err;
2270 } LDKCResultPtr_InMemoryChannelKeys__DecodeError;
2272 typedef struct LDKCResultTempl_InMemoryChannelKeys__DecodeError {
2273 union LDKCResultPtr_InMemoryChannelKeys__DecodeError contents;
2275 } LDKCResultTempl_InMemoryChannelKeys__DecodeError;
2277 typedef struct LDKCResultTempl_InMemoryChannelKeys__DecodeError LDKCResult_InMemoryChannelKeysDecodeErrorZ;
2282 * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
2283 * and derives keys from that.
2285 * Your node_id is seed/0'
2286 * ChannelMonitor closes may use seed/1'
2287 * Cooperative closes may use seed/2'
2288 * The two close keys may be needed to claim on-chain funds!
2290 typedef struct MUST_USE_STRUCT LDKKeysManager {
2292 * Nearly everywhere, inner must be non-null, however in places where
2293 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2295 LDKnativeKeysManager *inner;
2302 * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2304 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2306 * Nearly everywhere, inner must be non-null, however in places where
2307 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2309 LDKnativeChannelDetails *inner;
2311 } LDKChannelDetails;
2316 * Features used within an `init` message.
2318 typedef struct MUST_USE_STRUCT LDKInitFeatures {
2320 * Nearly everywhere, inner must be non-null, however in places where
2321 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2323 LDKnativeInitFeatures *inner;
2327 typedef struct LDKCVecTempl_ChannelDetails {
2328 struct LDKChannelDetails *data;
2330 } LDKCVecTempl_ChannelDetails;
2332 typedef struct LDKCVecTempl_ChannelDetails LDKCVec_ChannelDetailsZ;
2337 * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2338 * it can take multiple paths. Each path is composed of one or more hops through the network.
2340 typedef struct MUST_USE_STRUCT LDKRoute {
2342 * Nearly everywhere, inner must be non-null, however in places where
2343 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2345 LDKnativeRoute *inner;
2349 typedef struct LDKThreeBytes {
2353 typedef struct LDKFourBytes {
2357 typedef struct LDKSixteenBytes {
2361 typedef struct LDKTenBytes {
2366 * An address which can be used to connect to a remote peer
2368 typedef enum LDKNetAddress_Tag {
2370 * An IPv4 address/port on which the peer is listening.
2374 * An IPv6 address/port on which the peer is listening.
2378 * An old-style Tor onion address/port on which the peer is listening.
2380 LDKNetAddress_OnionV2,
2382 * A new-style Tor onion address/port on which the peer is listening.
2383 * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
2384 * wrap as base32 and append \".onion\".
2386 LDKNetAddress_OnionV3,
2388 * Must be last for serialization purposes
2390 LDKNetAddress_Sentinel,
2391 } LDKNetAddress_Tag;
2393 typedef struct LDKNetAddress_LDKIPv4_Body {
2394 struct LDKFourBytes addr;
2396 } LDKNetAddress_LDKIPv4_Body;
2398 typedef struct LDKNetAddress_LDKIPv6_Body {
2399 struct LDKSixteenBytes addr;
2401 } LDKNetAddress_LDKIPv6_Body;
2403 typedef struct LDKNetAddress_LDKOnionV2_Body {
2404 struct LDKTenBytes addr;
2406 } LDKNetAddress_LDKOnionV2_Body;
2408 typedef struct LDKNetAddress_LDKOnionV3_Body {
2409 struct LDKThirtyTwoBytes ed25519_pubkey;
2413 } LDKNetAddress_LDKOnionV3_Body;
2415 typedef struct MUST_USE_STRUCT LDKNetAddress {
2416 LDKNetAddress_Tag tag;
2418 LDKNetAddress_LDKIPv4_Body i_pv4;
2419 LDKNetAddress_LDKIPv6_Body i_pv6;
2420 LDKNetAddress_LDKOnionV2_Body onion_v2;
2421 LDKNetAddress_LDKOnionV3_Body onion_v3;
2425 typedef struct LDKCVecTempl_NetAddress {
2426 struct LDKNetAddress *data;
2428 } LDKCVecTempl_NetAddress;
2430 typedef struct LDKCVecTempl_NetAddress LDKCVec_NetAddressZ;
2435 * An update_add_htlc message to be sent or received from a peer
2437 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
2439 * Nearly everywhere, inner must be non-null, however in places where
2440 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2442 LDKnativeUpdateAddHTLC *inner;
2449 * An update_fulfill_htlc message to be sent or received from a peer
2451 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
2453 * Nearly everywhere, inner must be non-null, however in places where
2454 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2456 LDKnativeUpdateFulfillHTLC *inner;
2458 } LDKUpdateFulfillHTLC;
2463 * An update_fail_htlc message to be sent or received from a peer
2465 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
2467 * Nearly everywhere, inner must be non-null, however in places where
2468 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2470 LDKnativeUpdateFailHTLC *inner;
2472 } LDKUpdateFailHTLC;
2477 * An update_fail_malformed_htlc message to be sent or received from a peer
2479 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
2481 * Nearly everywhere, inner must be non-null, however in places where
2482 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2484 LDKnativeUpdateFailMalformedHTLC *inner;
2486 } LDKUpdateFailMalformedHTLC;
2491 * A commitment_signed message to be sent or received from a peer
2493 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
2495 * Nearly everywhere, inner must be non-null, however in places where
2496 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2498 LDKnativeCommitmentSigned *inner;
2500 } LDKCommitmentSigned;
2505 * An update_fee message to be sent or received from a peer
2507 typedef struct MUST_USE_STRUCT LDKUpdateFee {
2509 * Nearly everywhere, inner must be non-null, however in places where
2510 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2512 LDKnativeUpdateFee *inner;
2519 * An init message to be sent or received from a peer
2521 typedef struct MUST_USE_STRUCT LDKInit {
2523 * Nearly everywhere, inner must be non-null, however in places where
2524 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2526 LDKnativeInit *inner;
2531 * A trait to describe an object which can receive channel messages.
2533 * Messages MAY be called in parallel when they originate from different their_node_ids, however
2534 * they MUST NOT be called in parallel when the two calls have the same their_node_id.
2536 typedef struct LDKChannelMessageHandler {
2539 * Handle an incoming open_channel message from the given peer.
2541 void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
2543 * Handle an incoming accept_channel message from the given peer.
2545 void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
2547 * Handle an incoming funding_created message from the given peer.
2549 void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
2551 * Handle an incoming funding_signed message from the given peer.
2553 void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
2555 * Handle an incoming funding_locked message from the given peer.
2557 void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
2559 * Handle an incoming shutdown message from the given peer.
2561 void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg);
2563 * Handle an incoming closing_signed message from the given peer.
2565 void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
2567 * Handle an incoming update_add_htlc message from the given peer.
2569 void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
2571 * Handle an incoming update_fulfill_htlc message from the given peer.
2573 void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
2575 * Handle an incoming update_fail_htlc message from the given peer.
2577 void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
2579 * Handle an incoming update_fail_malformed_htlc message from the given peer.
2581 void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
2583 * Handle an incoming commitment_signed message from the given peer.
2585 void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
2587 * Handle an incoming revoke_and_ack message from the given peer.
2589 void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
2591 * Handle an incoming update_fee message from the given peer.
2593 void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
2595 * Handle an incoming announcement_signatures message from the given peer.
2597 void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
2599 * Indicates a connection to the peer failed/an existing connection was lost. If no connection
2600 * is believed to be possible in the future (eg they're sending us messages we don't
2601 * understand or indicate they require unknown feature bits), no_connection_possible is set
2602 * and any outstanding channels should be failed.
2604 void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
2606 * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
2608 void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
2610 * Handle an incoming channel_reestablish message from the given peer.
2612 void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
2614 * Handle an incoming error message from the given peer.
2616 void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
2617 struct LDKMessageSendEventsProvider MessageSendEventsProvider;
2618 void (*free)(void *this_arg);
2619 } LDKChannelMessageHandler;
2624 * Arguments for the creation of a ChannelManager that are not deserialized.
2626 * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
2628 * 1) Deserialize all stored ChannelMonitors.
2629 * 2) Deserialize the ChannelManager by filling in this struct and calling <(Sha256dHash,
2630 * ChannelManager)>::read(reader, args).
2631 * This may result in closing some Channels if the ChannelMonitor is newer than the stored
2632 * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
2633 * 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
2634 * ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo().
2635 * 4) Reconnect blocks on your ChannelMonitors.
2636 * 5) Move the ChannelMonitors into your local chain::Watch.
2637 * 6) Disconnect/connect blocks on the ChannelManager.
2639 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
2641 * Nearly everywhere, inner must be non-null, however in places where
2642 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2644 LDKnativeChannelManagerReadArgs *inner;
2646 } LDKChannelManagerReadArgs;
2648 typedef struct LDKCVecTempl_ChannelMonitor {
2649 struct LDKChannelMonitor *data;
2651 } LDKCVecTempl_ChannelMonitor;
2653 typedef struct LDKCVecTempl_ChannelMonitor LDKCVec_ChannelMonitorZ;
2655 typedef union LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError {
2656 struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager *result;
2657 struct LDKDecodeError *err;
2658 } LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError;
2660 typedef struct LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError {
2661 union LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError contents;
2663 } LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError;
2665 typedef struct LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
2670 * A ping message to be sent or received from a peer
2672 typedef struct MUST_USE_STRUCT LDKPing {
2674 * Nearly everywhere, inner must be non-null, however in places where
2675 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2677 LDKnativePing *inner;
2684 * A pong message to be sent or received from a peer
2686 typedef struct MUST_USE_STRUCT LDKPong {
2688 * Nearly everywhere, inner must be non-null, however in places where
2689 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2691 LDKnativePong *inner;
2698 * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
2699 * This is used to convince the recipient that the channel is at a certain commitment
2700 * number even if they lost that data due to a local failure. Of course, the peer may lie
2701 * and even later commitments may have been revoked.
2703 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
2705 * Nearly everywhere, inner must be non-null, however in places where
2706 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2708 LDKnativeDataLossProtect *inner;
2710 } LDKDataLossProtect;
2712 typedef union LDKCResultPtr_NetAddress__u8 {
2713 struct LDKNetAddress *result;
2715 } LDKCResultPtr_NetAddress__u8;
2717 typedef struct LDKCResultTempl_NetAddress__u8 {
2718 union LDKCResultPtr_NetAddress__u8 contents;
2720 } LDKCResultTempl_NetAddress__u8;
2722 typedef union LDKCResultPtr_CResultTempl_NetAddress__u8_____DecodeError {
2723 struct LDKCResultTempl_NetAddress__u8 *result;
2724 struct LDKDecodeError *err;
2725 } LDKCResultPtr_CResultTempl_NetAddress__u8_____DecodeError;
2727 typedef struct LDKCResultTempl_CResultTempl_NetAddress__u8_____DecodeError {
2728 union LDKCResultPtr_CResultTempl_NetAddress__u8_____DecodeError contents;
2730 } LDKCResultTempl_CResultTempl_NetAddress__u8_____DecodeError;
2732 typedef struct LDKCResultTempl_CResultTempl_NetAddress__u8_____DecodeError LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
2737 * The unsigned part of a node_announcement
2739 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
2741 * Nearly everywhere, inner must be non-null, however in places where
2742 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2744 LDKnativeUnsignedNodeAnnouncement *inner;
2746 } LDKUnsignedNodeAnnouncement;
2751 * Features used within a `node_announcement` message.
2753 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
2755 * Nearly everywhere, inner must be non-null, however in places where
2756 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2758 LDKnativeNodeFeatures *inner;
2765 * Features used within a `channel_announcement` message.
2767 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
2769 * Nearly everywhere, inner must be non-null, however in places where
2770 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2772 LDKnativeChannelFeatures *inner;
2774 } LDKChannelFeatures;
2779 * The unsigned part of a channel_update
2781 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
2783 * Nearly everywhere, inner must be non-null, however in places where
2784 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2786 LDKnativeUnsignedChannelUpdate *inner;
2788 } LDKUnsignedChannelUpdate;
2793 * A reply_channel_range message is a reply to a query_channel_range
2794 * message. Multiple reply_channel_range messages can be sent in reply
2795 * to a single query_channel_range message. The query recipient makes a
2796 * best effort to respond based on their local network view which may
2797 * not be a perfect view of the network. The short_channel_ids in the
2798 * reply are encoded. We only support encoding_type=0 uncompressed
2799 * serialization and do not support encoding_type=1 zlib serialization.
2801 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2803 * Nearly everywhere, inner must be non-null, however in places where
2804 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2806 LDKnativeReplyChannelRange *inner;
2808 } LDKReplyChannelRange;
2810 typedef struct LDKCVecTempl_u64 {
2815 typedef struct LDKCVecTempl_u64 LDKCVec_u64Z;
2820 * A reply_short_channel_ids_end message is sent as a reply to a
2821 * query_short_channel_ids message. The query recipient makes a best
2822 * effort to respond based on their local network view which may not be
2823 * a perfect view of the network.
2825 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
2827 * Nearly everywhere, inner must be non-null, however in places where
2828 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2830 LDKnativeReplyShortChannelIdsEnd *inner;
2832 } LDKReplyShortChannelIdsEnd;
2837 * A gossip_timestamp_filter message is used by a node to request
2838 * gossip relay for messages in the requested time range when the
2839 * gossip_queries feature has been negotiated.
2841 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
2843 * Nearly everywhere, inner must be non-null, however in places where
2844 * the Rust equivalent takes an Option, it may be set to null to indicate None.
2846 LDKnativeGossipTimestampFilter *inner;
2848 } LDKGossipTimestampFilter;
2850 typedef struct LDKCVecTempl_UpdateAddHTLC {
2851 struct LDKUpdateAddHTLC *data;
2853 } LDKCVecTempl_UpdateAddHTLC;
2855 typedef struct LDKCVecTempl_UpdateAddHTLC LDKCVec_UpdateAddHTLCZ;
2857 typedef struct LDKCVecTempl_UpdateFulfillHTLC {
2858 struct LDKUpdateFulfillHTLC *data;
2860 } LDKCVecTempl_UpdateFulfillHTLC;
2862 typedef struct LDKCVecTempl_UpdateFulfillHTLC LDKCVec_UpdateFulfillHTLCZ;
2864 typedef struct LDKCVecTempl_UpdateFailHTLC {
2865 struct LDKUpdateFailHTLC *data;
2867 } LDKCVecTempl_UpdateFailHTLC;
2869 typedef struct LDKCVecTempl_UpdateFailHTLC LDKCVec_UpdateFailHTLCZ;
2871 typedef struct LDKCVecTempl_UpdateFailMalformedHTLC {
2872 struct LDKUpdateFailMalformedHTLC *data;
2874 } LDKCVecTempl_UpdateFailMalformedHTLC;
2876 typedef struct LDKCVecTempl_UpdateFailMalformedHTLC LDKCVec_UpdateFailMalformedHTLCZ;
2878 typedef union LDKCResultPtr_bool__LightningError {
2880 struct LDKLightningError *err;
2881 } LDKCResultPtr_bool__LightningError;
2883 typedef struct LDKCResultTempl_bool__LightningError {
2884 union LDKCResultPtr_bool__LightningError contents;
2886 } LDKCResultTempl_bool__LightningError;
2888 typedef struct LDKCResultTempl_bool__LightningError LDKCResult_boolLightningErrorZ;
2890 typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate {
2891 struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *data;
2893 } LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate;
2895 typedef struct LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
2897 typedef struct LDKCVecTempl_NodeAnnouncement {
2898 struct LDKNodeAnnouncement *data;
2900 } LDKCVecTempl_NodeAnnouncement;
2902 typedef struct LDKCVecTempl_NodeAnnouncement LDKCVec_NodeAnnouncementZ;
2905 * A trait to describe an object which can receive routing messages.
2907 * # Implementor DoS Warnings
2909 * For `gossip_queries` messages there are potential DoS vectors when handling
2910 * inbound queries. Implementors using an on-disk network graph should be aware of
2911 * repeated disk I/O for queries accessing different parts of the network graph.
2913 typedef struct LDKRoutingMessageHandler {
2916 * Handle an incoming node_announcement message, returning true if it should be forwarded on,
2917 * false or returning an Err otherwise.
2919 LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
2921 * Handle a channel_announcement message, returning true if it should be forwarded on, false
2922 * or returning an Err otherwise.
2924 LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
2926 * Handle an incoming channel_update message, returning true if it should be forwarded on,
2927 * false or returning an Err otherwise.
2929 LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
2931 * Handle some updates to the route graph that we learned due to an outbound failed payment.
2933 void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
2935 * Gets a subset of the channel announcements and updates required to dump our routing table
2936 * to a remote node, starting at the short_channel_id indicated by starting_point and
2937 * including the batch_amount entries immediately higher in numerical value than starting_point.
2939 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
2941 * Gets a subset of the node announcements required to dump our routing table to a remote node,
2942 * starting at the node *after* the provided publickey and including batch_amount entries
2943 * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
2944 * If None is provided for starting_point, we start at the first node.
2946 LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
2948 * Called when a connection is established with a peer. This can be used to
2949 * perform routing table synchronization using a strategy defined by the
2952 void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
2954 * Handles the reply of a query we initiated to learn about channels
2955 * for a given range of blocks. We can expect to receive one or more
2956 * replies to a single query.
2958 LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
2960 * Handles the reply of a query we initiated asking for routing gossip
2961 * messages for a list of channels. We should receive this message when
2962 * a node has completed its best effort to send us the pertaining routing
2965 LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
2967 * Handles when a peer asks us to send a list of short_channel_ids
2968 * for the requested range of blocks.
2970 LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
2972 * Handles when a peer asks us to send routing gossip messages for a
2973 * list of short_channel_ids.
2975 LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
2976 struct LDKMessageSendEventsProvider MessageSendEventsProvider;
2977 void (*free)(void *this_arg);
2978 } LDKRoutingMessageHandler;
2980 typedef union LDKCResultPtr_ChannelReestablish__DecodeError {
2981 struct LDKChannelReestablish *result;
2982 struct LDKDecodeError *err;
2983 } LDKCResultPtr_ChannelReestablish__DecodeError;
2985 typedef struct LDKCResultTempl_ChannelReestablish__DecodeError {
2986 union LDKCResultPtr_ChannelReestablish__DecodeError contents;
2988 } LDKCResultTempl_ChannelReestablish__DecodeError;
2990 typedef struct LDKCResultTempl_ChannelReestablish__DecodeError LDKCResult_ChannelReestablishDecodeErrorZ;
2992 typedef union LDKCResultPtr_Init__DecodeError {
2993 struct LDKInit *result;
2994 struct LDKDecodeError *err;
2995 } LDKCResultPtr_Init__DecodeError;
2997 typedef struct LDKCResultTempl_Init__DecodeError {
2998 union LDKCResultPtr_Init__DecodeError contents;
3000 } LDKCResultTempl_Init__DecodeError;
3002 typedef struct LDKCResultTempl_Init__DecodeError LDKCResult_InitDecodeErrorZ;
3004 typedef union LDKCResultPtr_Ping__DecodeError {
3005 struct LDKPing *result;
3006 struct LDKDecodeError *err;
3007 } LDKCResultPtr_Ping__DecodeError;
3009 typedef struct LDKCResultTempl_Ping__DecodeError {
3010 union LDKCResultPtr_Ping__DecodeError contents;
3012 } LDKCResultTempl_Ping__DecodeError;
3014 typedef struct LDKCResultTempl_Ping__DecodeError LDKCResult_PingDecodeErrorZ;
3016 typedef union LDKCResultPtr_Pong__DecodeError {
3017 struct LDKPong *result;
3018 struct LDKDecodeError *err;
3019 } LDKCResultPtr_Pong__DecodeError;
3021 typedef struct LDKCResultTempl_Pong__DecodeError {
3022 union LDKCResultPtr_Pong__DecodeError contents;
3024 } LDKCResultTempl_Pong__DecodeError;
3026 typedef struct LDKCResultTempl_Pong__DecodeError LDKCResult_PongDecodeErrorZ;
3028 typedef union LDKCResultPtr_UnsignedChannelAnnouncement__DecodeError {
3029 struct LDKUnsignedChannelAnnouncement *result;
3030 struct LDKDecodeError *err;
3031 } LDKCResultPtr_UnsignedChannelAnnouncement__DecodeError;
3033 typedef struct LDKCResultTempl_UnsignedChannelAnnouncement__DecodeError {
3034 union LDKCResultPtr_UnsignedChannelAnnouncement__DecodeError contents;
3036 } LDKCResultTempl_UnsignedChannelAnnouncement__DecodeError;
3038 typedef struct LDKCResultTempl_UnsignedChannelAnnouncement__DecodeError LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
3040 typedef union LDKCResultPtr_UnsignedChannelUpdate__DecodeError {
3041 struct LDKUnsignedChannelUpdate *result;
3042 struct LDKDecodeError *err;
3043 } LDKCResultPtr_UnsignedChannelUpdate__DecodeError;
3045 typedef struct LDKCResultTempl_UnsignedChannelUpdate__DecodeError {
3046 union LDKCResultPtr_UnsignedChannelUpdate__DecodeError contents;
3048 } LDKCResultTempl_UnsignedChannelUpdate__DecodeError;
3050 typedef struct LDKCResultTempl_UnsignedChannelUpdate__DecodeError LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
3052 typedef union LDKCResultPtr_ErrorMessage__DecodeError {
3053 struct LDKErrorMessage *result;
3054 struct LDKDecodeError *err;
3055 } LDKCResultPtr_ErrorMessage__DecodeError;
3057 typedef struct LDKCResultTempl_ErrorMessage__DecodeError {
3058 union LDKCResultPtr_ErrorMessage__DecodeError contents;
3060 } LDKCResultTempl_ErrorMessage__DecodeError;
3062 typedef struct LDKCResultTempl_ErrorMessage__DecodeError LDKCResult_ErrorMessageDecodeErrorZ;
3064 typedef union LDKCResultPtr_UnsignedNodeAnnouncement__DecodeError {
3065 struct LDKUnsignedNodeAnnouncement *result;
3066 struct LDKDecodeError *err;
3067 } LDKCResultPtr_UnsignedNodeAnnouncement__DecodeError;
3069 typedef struct LDKCResultTempl_UnsignedNodeAnnouncement__DecodeError {
3070 union LDKCResultPtr_UnsignedNodeAnnouncement__DecodeError contents;
3072 } LDKCResultTempl_UnsignedNodeAnnouncement__DecodeError;
3074 typedef struct LDKCResultTempl_UnsignedNodeAnnouncement__DecodeError LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
3076 typedef union LDKCResultPtr_QueryShortChannelIds__DecodeError {
3077 struct LDKQueryShortChannelIds *result;
3078 struct LDKDecodeError *err;
3079 } LDKCResultPtr_QueryShortChannelIds__DecodeError;
3081 typedef struct LDKCResultTempl_QueryShortChannelIds__DecodeError {
3082 union LDKCResultPtr_QueryShortChannelIds__DecodeError contents;
3084 } LDKCResultTempl_QueryShortChannelIds__DecodeError;
3086 typedef struct LDKCResultTempl_QueryShortChannelIds__DecodeError LDKCResult_QueryShortChannelIdsDecodeErrorZ;
3088 typedef union LDKCResultPtr_ReplyShortChannelIdsEnd__DecodeError {
3089 struct LDKReplyShortChannelIdsEnd *result;
3090 struct LDKDecodeError *err;
3091 } LDKCResultPtr_ReplyShortChannelIdsEnd__DecodeError;
3093 typedef struct LDKCResultTempl_ReplyShortChannelIdsEnd__DecodeError {
3094 union LDKCResultPtr_ReplyShortChannelIdsEnd__DecodeError contents;
3096 } LDKCResultTempl_ReplyShortChannelIdsEnd__DecodeError;
3098 typedef struct LDKCResultTempl_ReplyShortChannelIdsEnd__DecodeError LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
3100 typedef union LDKCResultPtr_QueryChannelRange__DecodeError {
3101 struct LDKQueryChannelRange *result;
3102 struct LDKDecodeError *err;
3103 } LDKCResultPtr_QueryChannelRange__DecodeError;
3105 typedef struct LDKCResultTempl_QueryChannelRange__DecodeError {
3106 union LDKCResultPtr_QueryChannelRange__DecodeError contents;
3108 } LDKCResultTempl_QueryChannelRange__DecodeError;
3110 typedef struct LDKCResultTempl_QueryChannelRange__DecodeError LDKCResult_QueryChannelRangeDecodeErrorZ;
3112 typedef union LDKCResultPtr_ReplyChannelRange__DecodeError {
3113 struct LDKReplyChannelRange *result;
3114 struct LDKDecodeError *err;
3115 } LDKCResultPtr_ReplyChannelRange__DecodeError;
3117 typedef struct LDKCResultTempl_ReplyChannelRange__DecodeError {
3118 union LDKCResultPtr_ReplyChannelRange__DecodeError contents;
3120 } LDKCResultTempl_ReplyChannelRange__DecodeError;
3122 typedef struct LDKCResultTempl_ReplyChannelRange__DecodeError LDKCResult_ReplyChannelRangeDecodeErrorZ;
3124 typedef union LDKCResultPtr_GossipTimestampFilter__DecodeError {
3125 struct LDKGossipTimestampFilter *result;
3126 struct LDKDecodeError *err;
3127 } LDKCResultPtr_GossipTimestampFilter__DecodeError;
3129 typedef struct LDKCResultTempl_GossipTimestampFilter__DecodeError {
3130 union LDKCResultPtr_GossipTimestampFilter__DecodeError contents;
3132 } LDKCResultTempl_GossipTimestampFilter__DecodeError;
3134 typedef struct LDKCResultTempl_GossipTimestampFilter__DecodeError LDKCResult_GossipTimestampFilterDecodeErrorZ;
3139 * Provides references to trait impls which handle different types of messages.
3141 typedef struct MUST_USE_STRUCT LDKMessageHandler {
3143 * Nearly everywhere, inner must be non-null, however in places where
3144 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3146 LDKnativeMessageHandler *inner;
3148 } LDKMessageHandler;
3151 * Provides an object which can be used to send data to and which uniquely identifies a connection
3152 * to a remote host. You will need to be able to generate multiple of these which meet Eq and
3153 * implement Hash to meet the PeerManager API.
3155 * For efficiency, Clone should be relatively cheap for this type.
3157 * You probably want to just extend an int and put a file descriptor in a struct and implement
3158 * send_data. Note that if you are using a higher-level net library that may call close() itself,
3159 * be careful to ensure you don't have races whereby you might register a new connection with an
3160 * fd which is the same as a previous one which has yet to be removed via
3161 * PeerManager::socket_disconnected().
3163 typedef struct LDKSocketDescriptor {
3166 * Attempts to send some data from the given slice to the peer.
3168 * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
3169 * Note that in the disconnected case, socket_disconnected must still fire and further write
3170 * attempts may occur until that time.
3172 * If the returned size is smaller than data.len(), a write_available event must
3173 * trigger the next time more data can be written. Additionally, until the a send_data event
3174 * completes fully, no further read_events should trigger on the same peer!
3176 * If a read_event on this descriptor had previously returned true (indicating that read
3177 * events should be paused to prevent DoS in the send buffer), resume_read may be set
3178 * indicating that read events on this descriptor should resume. A resume_read of false does
3179 * *not* imply that further read events should be paused.
3181 uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
3183 * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
3184 * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
3185 * this descriptor. No socket_disconnected call should be generated as a result of this call,
3186 * though races may occur whereby disconnect_socket is called after a call to
3187 * socket_disconnected but prior to socket_disconnected returning.
3189 void (*disconnect_socket)(void *this_arg);
3190 bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
3191 uint64_t (*hash)(const void *this_arg);
3192 void *(*clone)(const void *this_arg);
3193 void (*free)(void *this_arg);
3194 } LDKSocketDescriptor;
3199 * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
3200 * events into messages which it passes on to its MessageHandlers.
3202 * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
3203 * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
3204 * essentially you should default to using a SimpleRefPeerManager, and use a
3205 * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
3206 * you're using lightning-net-tokio.
3208 typedef struct MUST_USE_STRUCT LDKPeerManager {
3210 * Nearly everywhere, inner must be non-null, however in places where
3211 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3213 LDKnativePeerManager *inner;
3217 typedef struct LDKCVecTempl_PublicKey {
3218 struct LDKPublicKey *data;
3220 } LDKCVecTempl_PublicKey;
3222 typedef struct LDKCVecTempl_PublicKey LDKCVec_PublicKeyZ;
3224 typedef union LDKCResultPtr_CVecTempl_u8_____PeerHandleError {
3225 struct LDKCVecTempl_u8 *result;
3226 struct LDKPeerHandleError *err;
3227 } LDKCResultPtr_CVecTempl_u8_____PeerHandleError;
3229 typedef struct LDKCResultTempl_CVecTempl_u8_____PeerHandleError {
3230 union LDKCResultPtr_CVecTempl_u8_____PeerHandleError contents;
3232 } LDKCResultTempl_CVecTempl_u8_____PeerHandleError;
3234 typedef struct LDKCResultTempl_CVecTempl_u8_____PeerHandleError LDKCResult_CVec_u8ZPeerHandleErrorZ;
3236 typedef union LDKCResultPtr_bool__PeerHandleError {
3238 struct LDKPeerHandleError *err;
3239 } LDKCResultPtr_bool__PeerHandleError;
3241 typedef struct LDKCResultTempl_bool__PeerHandleError {
3242 union LDKCResultPtr_bool__PeerHandleError contents;
3244 } LDKCResultTempl_bool__PeerHandleError;
3246 typedef struct LDKCResultTempl_bool__PeerHandleError LDKCResult_boolPeerHandleErrorZ;
3248 typedef union LDKCResultPtr_SecretKey__Secp256k1Error {
3249 struct LDKSecretKey *result;
3250 enum LDKSecp256k1Error *err;
3251 } LDKCResultPtr_SecretKey__Secp256k1Error;
3253 typedef struct LDKCResultTempl_SecretKey__Secp256k1Error {
3254 union LDKCResultPtr_SecretKey__Secp256k1Error contents;
3256 } LDKCResultTempl_SecretKey__Secp256k1Error;
3258 typedef struct LDKCResultTempl_SecretKey__Secp256k1Error LDKCResult_SecretKeySecpErrorZ;
3260 typedef union LDKCResultPtr_PublicKey__Secp256k1Error {
3261 struct LDKPublicKey *result;
3262 enum LDKSecp256k1Error *err;
3263 } LDKCResultPtr_PublicKey__Secp256k1Error;
3265 typedef struct LDKCResultTempl_PublicKey__Secp256k1Error {
3266 union LDKCResultPtr_PublicKey__Secp256k1Error contents;
3268 } LDKCResultTempl_PublicKey__Secp256k1Error;
3270 typedef struct LDKCResultTempl_PublicKey__Secp256k1Error LDKCResult_PublicKeySecpErrorZ;
3275 * The set of public keys which are used in the creation of one commitment transaction.
3276 * These are derived from the channel base keys and per-commitment data.
3278 * A broadcaster key is provided from potential broadcaster of the computed transaction.
3279 * A countersignatory key is coming from a protocol participant unable to broadcast the
3282 * These keys are assumed to be good, either because the code derived them from
3283 * channel basepoints via the new function, or they were obtained via
3284 * CommitmentTransaction.trust().keys() because we trusted the source of the
3285 * pre-calculated keys.
3287 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
3289 * Nearly everywhere, inner must be non-null, however in places where
3290 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3292 LDKnativeTxCreationKeys *inner;
3294 } LDKTxCreationKeys;
3296 typedef union LDKCResultPtr_TxCreationKeys__Secp256k1Error {
3297 struct LDKTxCreationKeys *result;
3298 enum LDKSecp256k1Error *err;
3299 } LDKCResultPtr_TxCreationKeys__Secp256k1Error;
3301 typedef struct LDKCResultTempl_TxCreationKeys__Secp256k1Error {
3302 union LDKCResultPtr_TxCreationKeys__Secp256k1Error contents;
3304 } LDKCResultTempl_TxCreationKeys__Secp256k1Error;
3306 typedef struct LDKCResultTempl_TxCreationKeys__Secp256k1Error LDKCResult_TxCreationKeysSecpErrorZ;
3311 * Late-bound per-channel counterparty data used to build transactions.
3313 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
3315 * Nearly everywhere, inner must be non-null, however in places where
3316 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3318 LDKnativeCounterpartyChannelTransactionParameters *inner;
3320 } LDKCounterpartyChannelTransactionParameters;
3325 * Static channel fields used to build transactions given per-commitment fields, organized by
3326 * broadcaster/countersignatory.
3328 * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
3329 * as_holder_broadcastable and as_counterparty_broadcastable functions.
3331 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
3333 * Nearly everywhere, inner must be non-null, however in places where
3334 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3336 LDKnativeDirectedChannelTransactionParameters *inner;
3338 } LDKDirectedChannelTransactionParameters;
3343 * A pre-built Bitcoin commitment transaction and its txid.
3345 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
3347 * Nearly everywhere, inner must be non-null, however in places where
3348 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3350 LDKnativeBuiltCommitmentTransaction *inner;
3352 } LDKBuiltCommitmentTransaction;
3359 typedef struct MUST_USE_STRUCT LDKRouteHop {
3361 * Nearly everywhere, inner must be non-null, however in places where
3362 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3364 LDKnativeRouteHop *inner;
3368 typedef struct LDKCVecTempl_RouteHop {
3369 struct LDKRouteHop *data;
3371 } LDKCVecTempl_RouteHop;
3373 typedef struct LDKCVecTempl_CVecTempl_RouteHop {
3374 struct LDKCVecTempl_RouteHop *data;
3376 } LDKCVecTempl_CVecTempl_RouteHop;
3378 typedef struct LDKCVecTempl_CVecTempl_RouteHop LDKCVec_CVec_RouteHopZZ;
3380 typedef union LDKCResultPtr_Route__DecodeError {
3381 struct LDKRoute *result;
3382 struct LDKDecodeError *err;
3383 } LDKCResultPtr_Route__DecodeError;
3385 typedef struct LDKCResultTempl_Route__DecodeError {
3386 union LDKCResultPtr_Route__DecodeError contents;
3388 } LDKCResultTempl_Route__DecodeError;
3390 typedef struct LDKCResultTempl_Route__DecodeError LDKCResult_RouteDecodeErrorZ;
3395 * A channel descriptor which provides a last-hop route to get_route
3397 typedef struct MUST_USE_STRUCT LDKRouteHint {
3399 * Nearly everywhere, inner must be non-null, however in places where
3400 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3402 LDKnativeRouteHint *inner;
3409 * Fees for routing via a given channel or a node
3411 typedef struct MUST_USE_STRUCT LDKRoutingFees {
3413 * Nearly everywhere, inner must be non-null, however in places where
3414 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3416 LDKnativeRoutingFees *inner;
3420 typedef union LDKCResultPtr_Route__LightningError {
3421 struct LDKRoute *result;
3422 struct LDKLightningError *err;
3423 } LDKCResultPtr_Route__LightningError;
3425 typedef struct LDKCResultTempl_Route__LightningError {
3426 union LDKCResultPtr_Route__LightningError contents;
3428 } LDKCResultTempl_Route__LightningError;
3430 typedef struct LDKCResultTempl_Route__LightningError LDKCResult_RouteLightningErrorZ;
3435 * Represents the network as nodes and channels between them
3437 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
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 LDKnativeNetworkGraph *inner;
3446 typedef struct LDKCVecTempl_RouteHint {
3447 struct LDKRouteHint *data;
3449 } LDKCVecTempl_RouteHint;
3451 typedef struct LDKCVecTempl_RouteHint LDKCVec_RouteHintZ;
3456 * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
3457 * This exists only to make accessing a RwLock<NetworkGraph> possible from
3458 * the C bindings, as it can be done directly in Rust code.
3460 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
3462 * Nearly everywhere, inner must be non-null, however in places where
3463 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3465 LDKnativeLockedNetworkGraph *inner;
3467 } LDKLockedNetworkGraph;
3472 * Receives and validates network updates from peers,
3473 * stores authentic and relevant data as a network graph.
3474 * This network graph is then used for routing payments.
3475 * Provides interface to help with initial routing sync by
3476 * serving historical announcements.
3478 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
3480 * Nearly everywhere, inner must be non-null, however in places where
3481 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3483 LDKnativeNetGraphMsgHandler *inner;
3485 } LDKNetGraphMsgHandler;
3490 * Details about one direction of a channel. Received
3491 * within a channel update.
3493 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
3495 * Nearly everywhere, inner must be non-null, however in places where
3496 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3498 LDKnativeDirectionalChannelInfo *inner;
3500 } LDKDirectionalChannelInfo;
3505 * Details about a channel (both directions).
3506 * Received within a channel announcement.
3508 typedef struct MUST_USE_STRUCT LDKChannelInfo {
3510 * Nearly everywhere, inner must be non-null, however in places where
3511 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3513 LDKnativeChannelInfo *inner;
3517 typedef union LDKCResultPtr_RoutingFees__DecodeError {
3518 struct LDKRoutingFees *result;
3519 struct LDKDecodeError *err;
3520 } LDKCResultPtr_RoutingFees__DecodeError;
3522 typedef struct LDKCResultTempl_RoutingFees__DecodeError {
3523 union LDKCResultPtr_RoutingFees__DecodeError contents;
3525 } LDKCResultTempl_RoutingFees__DecodeError;
3527 typedef struct LDKCResultTempl_RoutingFees__DecodeError LDKCResult_RoutingFeesDecodeErrorZ;
3532 * Information received in the latest node_announcement from this node.
3534 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
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 LDKnativeNodeAnnouncementInfo *inner;
3541 } LDKNodeAnnouncementInfo;
3543 typedef union LDKCResultPtr_NodeAnnouncementInfo__DecodeError {
3544 struct LDKNodeAnnouncementInfo *result;
3545 struct LDKDecodeError *err;
3546 } LDKCResultPtr_NodeAnnouncementInfo__DecodeError;
3548 typedef struct LDKCResultTempl_NodeAnnouncementInfo__DecodeError {
3549 union LDKCResultPtr_NodeAnnouncementInfo__DecodeError contents;
3551 } LDKCResultTempl_NodeAnnouncementInfo__DecodeError;
3553 typedef struct LDKCResultTempl_NodeAnnouncementInfo__DecodeError LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
3558 * Details about a node in the network, known from the network announcement.
3560 typedef struct MUST_USE_STRUCT LDKNodeInfo {
3562 * Nearly everywhere, inner must be non-null, however in places where
3563 * the Rust equivalent takes an Option, it may be set to null to indicate None.
3565 LDKnativeNodeInfo *inner;
3569 typedef union LDKCResultPtr_NodeInfo__DecodeError {
3570 struct LDKNodeInfo *result;
3571 struct LDKDecodeError *err;
3572 } LDKCResultPtr_NodeInfo__DecodeError;
3574 typedef struct LDKCResultTempl_NodeInfo__DecodeError {
3575 union LDKCResultPtr_NodeInfo__DecodeError contents;
3577 } LDKCResultTempl_NodeInfo__DecodeError;
3579 typedef struct LDKCResultTempl_NodeInfo__DecodeError LDKCResult_NodeInfoDecodeErrorZ;
3581 typedef union LDKCResultPtr_NetworkGraph__DecodeError {
3582 struct LDKNetworkGraph *result;
3583 struct LDKDecodeError *err;
3584 } LDKCResultPtr_NetworkGraph__DecodeError;
3586 typedef struct LDKCResultTempl_NetworkGraph__DecodeError {
3587 union LDKCResultPtr_NetworkGraph__DecodeError contents;
3589 } LDKCResultTempl_NetworkGraph__DecodeError;
3591 typedef struct LDKCResultTempl_NetworkGraph__DecodeError LDKCResult_NetworkGraphDecodeErrorZ;
3593 typedef struct LDKCResultTempl_NetAddress__u8 LDKCResult_NetAddressu8Z;
3595 typedef struct LDKCVecTempl_RouteHop LDKCVec_RouteHopZ;
3597 extern const void (*CVec_SpendableOutputDescriptorZ_free)(LDKCVec_SpendableOutputDescriptorZ);
3599 extern const void (*CVec_MessageSendEventZ_free)(LDKCVec_MessageSendEventZ);
3601 extern const void (*CVec_EventZ_free)(LDKCVec_EventZ);
3603 extern const void (*C2Tuple_usizeTransactionZ_free)(LDKC2Tuple_usizeTransactionZ);
3605 extern const void (*CVec_C2Tuple_usizeTransactionZZ_free)(LDKCVec_C2Tuple_usizeTransactionZZ);
3607 extern const void (*CResult_NoneChannelMonitorUpdateErrZ_free)(LDKCResult_NoneChannelMonitorUpdateErrZ);
3609 extern const LDKCResult_NoneChannelMonitorUpdateErrZ (*CResult_NoneChannelMonitorUpdateErrZ_err)(enum LDKChannelMonitorUpdateErr);
3611 extern const void (*CVec_MonitorEventZ_free)(LDKCVec_MonitorEventZ);
3613 extern const void (*CResult_ChannelMonitorUpdateDecodeErrorZ_free)(LDKCResult_ChannelMonitorUpdateDecodeErrorZ);
3615 extern const LDKCResult_ChannelMonitorUpdateDecodeErrorZ (*CResult_ChannelMonitorUpdateDecodeErrorZ_ok)(struct LDKChannelMonitorUpdate);
3617 extern const LDKCResult_ChannelMonitorUpdateDecodeErrorZ (*CResult_ChannelMonitorUpdateDecodeErrorZ_err)(struct LDKDecodeError);
3619 extern const void (*CResult_NoneMonitorUpdateErrorZ_free)(LDKCResult_NoneMonitorUpdateErrorZ);
3621 extern const LDKCResult_NoneMonitorUpdateErrorZ (*CResult_NoneMonitorUpdateErrorZ_err)(struct LDKMonitorUpdateError);
3623 extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ);
3625 extern const void (*CVec_TransactionZ_free)(LDKCVec_TransactionZ);
3627 extern const void (*C2Tuple_u32TxOutZ_free)(LDKC2Tuple_u32TxOutZ);
3629 extern const void (*CVec_C2Tuple_u32TxOutZZ_free)(LDKCVec_C2Tuple_u32TxOutZZ);
3631 extern const void (*C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free)(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ);
3633 extern const void (*CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free)(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ);
3635 extern const void (*C2Tuple_BlockHashChannelMonitorZ_free)(LDKC2Tuple_BlockHashChannelMonitorZ);
3637 extern const void (*CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free)(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ);
3639 extern const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ (*CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok)(LDKC2Tuple_BlockHashChannelMonitorZ);
3641 extern const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ (*CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err)(struct LDKDecodeError);
3643 extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z);
3645 extern const void (*CResult_SpendableOutputDescriptorDecodeErrorZ_free)(LDKCResult_SpendableOutputDescriptorDecodeErrorZ);
3647 extern const LDKCResult_SpendableOutputDescriptorDecodeErrorZ (*CResult_SpendableOutputDescriptorDecodeErrorZ_ok)(struct LDKSpendableOutputDescriptor);
3649 extern const LDKCResult_SpendableOutputDescriptorDecodeErrorZ (*CResult_SpendableOutputDescriptorDecodeErrorZ_err)(struct LDKDecodeError);
3651 extern const void (*CVec_SignatureZ_free)(LDKCVec_SignatureZ);
3653 extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ);
3655 extern const void (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free)(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ);
3657 extern const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok)(LDKC2Tuple_SignatureCVec_SignatureZZ);
3659 extern const void (*CResult_SignatureNoneZ_free)(LDKCResult_SignatureNoneZ);
3661 extern const LDKCResult_SignatureNoneZ (*CResult_SignatureNoneZ_ok)(struct LDKSignature);
3663 extern const void (*CResult_ChanKeySignerDecodeErrorZ_free)(LDKCResult_ChanKeySignerDecodeErrorZ);
3665 extern const LDKCResult_ChanKeySignerDecodeErrorZ (*CResult_ChanKeySignerDecodeErrorZ_ok)(struct LDKChannelKeys);
3667 extern const LDKCResult_ChanKeySignerDecodeErrorZ (*CResult_ChanKeySignerDecodeErrorZ_err)(struct LDKDecodeError);
3669 extern const void (*CResult_InMemoryChannelKeysDecodeErrorZ_free)(LDKCResult_InMemoryChannelKeysDecodeErrorZ);
3671 extern const LDKCResult_InMemoryChannelKeysDecodeErrorZ (*CResult_InMemoryChannelKeysDecodeErrorZ_ok)(struct LDKInMemoryChannelKeys);
3673 extern const LDKCResult_InMemoryChannelKeysDecodeErrorZ (*CResult_InMemoryChannelKeysDecodeErrorZ_err)(struct LDKDecodeError);
3675 extern const void (*CResult_TxOutAccessErrorZ_free)(LDKCResult_TxOutAccessErrorZ);
3677 extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_ok)(struct LDKTxOut);
3679 extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_err)(enum LDKAccessError);
3681 extern const void (*CResult_NoneAPIErrorZ_free)(LDKCResult_NoneAPIErrorZ);
3683 extern const LDKCResult_NoneAPIErrorZ (*CResult_NoneAPIErrorZ_err)(struct LDKAPIError);
3685 extern const void (*CVec_ChannelDetailsZ_free)(LDKCVec_ChannelDetailsZ);
3687 extern const void (*CResult_NonePaymentSendFailureZ_free)(LDKCResult_NonePaymentSendFailureZ);
3689 extern const LDKCResult_NonePaymentSendFailureZ (*CResult_NonePaymentSendFailureZ_err)(struct LDKPaymentSendFailure);
3691 extern const void (*CVec_NetAddressZ_free)(LDKCVec_NetAddressZ);
3693 extern const void (*CVec_ChannelMonitorZ_free)(LDKCVec_ChannelMonitorZ);
3695 extern const void (*C2Tuple_BlockHashChannelManagerZ_free)(LDKC2Tuple_BlockHashChannelManagerZ);
3697 extern const void (*CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free)(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ);
3699 extern const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ (*CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok)(LDKC2Tuple_BlockHashChannelManagerZ);
3701 extern const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ (*CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err)(struct LDKDecodeError);
3703 extern const void (*CResult_NetAddressu8Z_free)(LDKCResult_NetAddressu8Z);
3705 extern const LDKCResult_NetAddressu8Z (*CResult_NetAddressu8Z_ok)(struct LDKNetAddress);
3707 extern const LDKCResult_NetAddressu8Z (*CResult_NetAddressu8Z_err)(uint8_t);
3709 extern const void (*CResult_CResult_NetAddressu8ZDecodeErrorZ_free)(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ);
3711 extern const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ (*CResult_CResult_NetAddressu8ZDecodeErrorZ_ok)(LDKCResult_NetAddressu8Z);
3713 extern const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ (*CResult_CResult_NetAddressu8ZDecodeErrorZ_err)(struct LDKDecodeError);
3715 extern const void (*CVec_u64Z_free)(LDKCVec_u64Z);
3717 extern const void (*CVec_UpdateAddHTLCZ_free)(LDKCVec_UpdateAddHTLCZ);
3719 extern const void (*CVec_UpdateFulfillHTLCZ_free)(LDKCVec_UpdateFulfillHTLCZ);
3721 extern const void (*CVec_UpdateFailHTLCZ_free)(LDKCVec_UpdateFailHTLCZ);
3723 extern const void (*CVec_UpdateFailMalformedHTLCZ_free)(LDKCVec_UpdateFailMalformedHTLCZ);
3725 extern const void (*CResult_boolLightningErrorZ_free)(LDKCResult_boolLightningErrorZ);
3727 extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_ok)(bool);
3729 extern const LDKCResult_boolLightningErrorZ (*CResult_boolLightningErrorZ_err)(struct LDKLightningError);
3731 extern const void (*C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free)(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ);
3733 extern const void (*CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free)(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ);
3735 extern const void (*CVec_NodeAnnouncementZ_free)(LDKCVec_NodeAnnouncementZ);
3737 extern const void (*CResult_NoneLightningErrorZ_free)(LDKCResult_NoneLightningErrorZ);
3739 extern const LDKCResult_NoneLightningErrorZ (*CResult_NoneLightningErrorZ_err)(struct LDKLightningError);
3741 extern const void (*CResult_ChannelReestablishDecodeErrorZ_free)(LDKCResult_ChannelReestablishDecodeErrorZ);
3743 extern const LDKCResult_ChannelReestablishDecodeErrorZ (*CResult_ChannelReestablishDecodeErrorZ_ok)(struct LDKChannelReestablish);
3745 extern const LDKCResult_ChannelReestablishDecodeErrorZ (*CResult_ChannelReestablishDecodeErrorZ_err)(struct LDKDecodeError);
3747 extern const void (*CResult_InitDecodeErrorZ_free)(LDKCResult_InitDecodeErrorZ);
3749 extern const LDKCResult_InitDecodeErrorZ (*CResult_InitDecodeErrorZ_ok)(struct LDKInit);
3751 extern const LDKCResult_InitDecodeErrorZ (*CResult_InitDecodeErrorZ_err)(struct LDKDecodeError);
3753 extern const void (*CResult_PingDecodeErrorZ_free)(LDKCResult_PingDecodeErrorZ);
3755 extern const LDKCResult_PingDecodeErrorZ (*CResult_PingDecodeErrorZ_ok)(struct LDKPing);
3757 extern const LDKCResult_PingDecodeErrorZ (*CResult_PingDecodeErrorZ_err)(struct LDKDecodeError);
3759 extern const void (*CResult_PongDecodeErrorZ_free)(LDKCResult_PongDecodeErrorZ);
3761 extern const LDKCResult_PongDecodeErrorZ (*CResult_PongDecodeErrorZ_ok)(struct LDKPong);
3763 extern const LDKCResult_PongDecodeErrorZ (*CResult_PongDecodeErrorZ_err)(struct LDKDecodeError);
3765 extern const void (*CResult_UnsignedChannelAnnouncementDecodeErrorZ_free)(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ);
3767 extern const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ (*CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok)(struct LDKUnsignedChannelAnnouncement);
3769 extern const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ (*CResult_UnsignedChannelAnnouncementDecodeErrorZ_err)(struct LDKDecodeError);
3771 extern const void (*CResult_UnsignedChannelUpdateDecodeErrorZ_free)(LDKCResult_UnsignedChannelUpdateDecodeErrorZ);
3773 extern const LDKCResult_UnsignedChannelUpdateDecodeErrorZ (*CResult_UnsignedChannelUpdateDecodeErrorZ_ok)(struct LDKUnsignedChannelUpdate);
3775 extern const LDKCResult_UnsignedChannelUpdateDecodeErrorZ (*CResult_UnsignedChannelUpdateDecodeErrorZ_err)(struct LDKDecodeError);
3777 extern const void (*CResult_ErrorMessageDecodeErrorZ_free)(LDKCResult_ErrorMessageDecodeErrorZ);
3779 extern const LDKCResult_ErrorMessageDecodeErrorZ (*CResult_ErrorMessageDecodeErrorZ_ok)(struct LDKErrorMessage);
3781 extern const LDKCResult_ErrorMessageDecodeErrorZ (*CResult_ErrorMessageDecodeErrorZ_err)(struct LDKDecodeError);
3783 extern const void (*CResult_UnsignedNodeAnnouncementDecodeErrorZ_free)(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ);
3785 extern const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ (*CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok)(struct LDKUnsignedNodeAnnouncement);
3787 extern const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ (*CResult_UnsignedNodeAnnouncementDecodeErrorZ_err)(struct LDKDecodeError);
3789 extern const void (*CResult_QueryShortChannelIdsDecodeErrorZ_free)(LDKCResult_QueryShortChannelIdsDecodeErrorZ);
3791 extern const LDKCResult_QueryShortChannelIdsDecodeErrorZ (*CResult_QueryShortChannelIdsDecodeErrorZ_ok)(struct LDKQueryShortChannelIds);
3793 extern const LDKCResult_QueryShortChannelIdsDecodeErrorZ (*CResult_QueryShortChannelIdsDecodeErrorZ_err)(struct LDKDecodeError);
3795 extern const void (*CResult_ReplyShortChannelIdsEndDecodeErrorZ_free)(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ);
3797 extern const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ (*CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok)(struct LDKReplyShortChannelIdsEnd);
3799 extern const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ (*CResult_ReplyShortChannelIdsEndDecodeErrorZ_err)(struct LDKDecodeError);
3801 extern const void (*CResult_QueryChannelRangeDecodeErrorZ_free)(LDKCResult_QueryChannelRangeDecodeErrorZ);
3803 extern const LDKCResult_QueryChannelRangeDecodeErrorZ (*CResult_QueryChannelRangeDecodeErrorZ_ok)(struct LDKQueryChannelRange);
3805 extern const LDKCResult_QueryChannelRangeDecodeErrorZ (*CResult_QueryChannelRangeDecodeErrorZ_err)(struct LDKDecodeError);
3807 extern const void (*CResult_ReplyChannelRangeDecodeErrorZ_free)(LDKCResult_ReplyChannelRangeDecodeErrorZ);
3809 extern const LDKCResult_ReplyChannelRangeDecodeErrorZ (*CResult_ReplyChannelRangeDecodeErrorZ_ok)(struct LDKReplyChannelRange);
3811 extern const LDKCResult_ReplyChannelRangeDecodeErrorZ (*CResult_ReplyChannelRangeDecodeErrorZ_err)(struct LDKDecodeError);
3813 extern const void (*CResult_GossipTimestampFilterDecodeErrorZ_free)(LDKCResult_GossipTimestampFilterDecodeErrorZ);
3815 extern const LDKCResult_GossipTimestampFilterDecodeErrorZ (*CResult_GossipTimestampFilterDecodeErrorZ_ok)(struct LDKGossipTimestampFilter);
3817 extern const LDKCResult_GossipTimestampFilterDecodeErrorZ (*CResult_GossipTimestampFilterDecodeErrorZ_err)(struct LDKDecodeError);
3819 extern const void (*CVec_PublicKeyZ_free)(LDKCVec_PublicKeyZ);
3821 extern const void (*CVec_u8Z_free)(LDKCVec_u8Z);
3823 extern const void (*CResult_CVec_u8ZPeerHandleErrorZ_free)(LDKCResult_CVec_u8ZPeerHandleErrorZ);
3825 extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_ok)(LDKCVec_u8Z);
3827 extern const LDKCResult_CVec_u8ZPeerHandleErrorZ (*CResult_CVec_u8ZPeerHandleErrorZ_err)(struct LDKPeerHandleError);
3829 extern const void (*CResult_NonePeerHandleErrorZ_free)(LDKCResult_NonePeerHandleErrorZ);
3831 extern const LDKCResult_NonePeerHandleErrorZ (*CResult_NonePeerHandleErrorZ_err)(struct LDKPeerHandleError);
3833 extern const void (*CResult_boolPeerHandleErrorZ_free)(LDKCResult_boolPeerHandleErrorZ);
3835 extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_ok)(bool);
3837 extern const LDKCResult_boolPeerHandleErrorZ (*CResult_boolPeerHandleErrorZ_err)(struct LDKPeerHandleError);
3839 extern const void (*CResult_SecretKeySecpErrorZ_free)(LDKCResult_SecretKeySecpErrorZ);
3841 extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_ok)(struct LDKSecretKey);
3843 extern const LDKCResult_SecretKeySecpErrorZ (*CResult_SecretKeySecpErrorZ_err)(enum LDKSecp256k1Error);
3845 extern const void (*CResult_PublicKeySecpErrorZ_free)(LDKCResult_PublicKeySecpErrorZ);
3847 extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_ok)(struct LDKPublicKey);
3849 extern const LDKCResult_PublicKeySecpErrorZ (*CResult_PublicKeySecpErrorZ_err)(enum LDKSecp256k1Error);
3851 extern const void (*CResult_TxCreationKeysSecpErrorZ_free)(LDKCResult_TxCreationKeysSecpErrorZ);
3853 extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_ok)(struct LDKTxCreationKeys);
3855 extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_err)(enum LDKSecp256k1Error);
3857 extern const void (*CResult_TrustedCommitmentTransactionNoneZ_free)(LDKCResult_TrustedCommitmentTransactionNoneZ);
3859 extern const LDKCResult_TrustedCommitmentTransactionNoneZ (*CResult_TrustedCommitmentTransactionNoneZ_ok)(struct LDKTrustedCommitmentTransaction);
3861 extern const void (*CResult_CVec_SignatureZNoneZ_free)(LDKCResult_CVec_SignatureZNoneZ);
3863 extern const LDKCResult_CVec_SignatureZNoneZ (*CResult_CVec_SignatureZNoneZ_ok)(LDKCVec_SignatureZ);
3865 extern const void (*CVec_RouteHopZ_free)(LDKCVec_RouteHopZ);
3867 extern const void (*CVec_CVec_RouteHopZZ_free)(LDKCVec_CVec_RouteHopZZ);
3869 extern const void (*CResult_RouteDecodeErrorZ_free)(LDKCResult_RouteDecodeErrorZ);
3871 extern const LDKCResult_RouteDecodeErrorZ (*CResult_RouteDecodeErrorZ_ok)(struct LDKRoute);
3873 extern const LDKCResult_RouteDecodeErrorZ (*CResult_RouteDecodeErrorZ_err)(struct LDKDecodeError);
3875 extern const void (*CVec_RouteHintZ_free)(LDKCVec_RouteHintZ);
3877 extern const void (*CResult_RouteLightningErrorZ_free)(LDKCResult_RouteLightningErrorZ);
3879 extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_ok)(struct LDKRoute);
3881 extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_err)(struct LDKLightningError);
3883 extern const void (*CResult_RoutingFeesDecodeErrorZ_free)(LDKCResult_RoutingFeesDecodeErrorZ);
3885 extern const LDKCResult_RoutingFeesDecodeErrorZ (*CResult_RoutingFeesDecodeErrorZ_ok)(struct LDKRoutingFees);
3887 extern const LDKCResult_RoutingFeesDecodeErrorZ (*CResult_RoutingFeesDecodeErrorZ_err)(struct LDKDecodeError);
3889 extern const void (*CResult_NodeAnnouncementInfoDecodeErrorZ_free)(LDKCResult_NodeAnnouncementInfoDecodeErrorZ);
3891 extern const LDKCResult_NodeAnnouncementInfoDecodeErrorZ (*CResult_NodeAnnouncementInfoDecodeErrorZ_ok)(struct LDKNodeAnnouncementInfo);
3893 extern const LDKCResult_NodeAnnouncementInfoDecodeErrorZ (*CResult_NodeAnnouncementInfoDecodeErrorZ_err)(struct LDKDecodeError);
3895 extern const void (*CResult_NodeInfoDecodeErrorZ_free)(LDKCResult_NodeInfoDecodeErrorZ);
3897 extern const LDKCResult_NodeInfoDecodeErrorZ (*CResult_NodeInfoDecodeErrorZ_ok)(struct LDKNodeInfo);
3899 extern const LDKCResult_NodeInfoDecodeErrorZ (*CResult_NodeInfoDecodeErrorZ_err)(struct LDKDecodeError);
3901 extern const void (*CResult_NetworkGraphDecodeErrorZ_free)(LDKCResult_NetworkGraphDecodeErrorZ);
3903 extern const LDKCResult_NetworkGraphDecodeErrorZ (*CResult_NetworkGraphDecodeErrorZ_ok)(struct LDKNetworkGraph);
3905 extern const LDKCResult_NetworkGraphDecodeErrorZ (*CResult_NetworkGraphDecodeErrorZ_err)(struct LDKDecodeError);
3907 extern const uintptr_t MAX_BUF_SIZE;
3909 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
3911 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
3913 void Transaction_free(struct LDKTransaction _res);
3915 void TxOut_free(struct LDKTxOut _res);
3917 LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
3919 LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
3921 LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
3923 LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, LDKCVec_u8Z b);
3925 LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
3927 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, LDKCVec_C2Tuple_u32TxOutZZ b);
3929 LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
3931 LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
3933 LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, LDKCVec_SignatureZ b);
3935 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
3937 LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
3939 LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
3941 LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
3943 LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
3945 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
3947 LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
3949 LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
3951 LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
3953 LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
3955 void Event_free(struct LDKEvent this_ptr);
3957 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
3959 LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
3961 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
3963 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
3966 * Calls the free function if one is set
3968 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
3971 * Calls the free function if one is set
3973 void EventsProvider_free(struct LDKEventsProvider this_ptr);
3975 void APIError_free(struct LDKAPIError this_ptr);
3977 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
3979 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
3982 * Returns the most verbose logging level.
3984 MUST_USE_RES enum LDKLevel Level_max(void);
3987 * Calls the free function if one is set
3989 void Logger_free(struct LDKLogger this_ptr);
3991 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_ptr);
3993 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
3996 * Confirmations we will wait for before considering the channel locked in.
3997 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
3998 * equivalent limit applied to outbound channels).
4002 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
4005 * Confirmations we will wait for before considering the channel locked in.
4006 * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
4007 * equivalent limit applied to outbound channels).
4011 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
4014 * Set to the amount of time we require our counterparty to wait to claim their money.
4016 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
4017 * be online to check for peer having broadcast a revoked transaction to steal our funds
4018 * at least once every our_to_self_delay blocks.
4020 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
4021 * case of an honest unilateral channel close, which implicitly decrease the economic value of
4024 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
4025 * opening so you can tweak config to ask for more security, not less.
4027 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
4030 * Set to the amount of time we require our counterparty to wait to claim their money.
4032 * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST
4033 * be online to check for peer having broadcast a revoked transaction to steal our funds
4034 * at least once every our_to_self_delay blocks.
4036 * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
4037 * case of an honest unilateral channel close, which implicitly decrease the economic value of
4040 * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel
4041 * opening so you can tweak config to ask for more security, not less.
4043 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
4046 * Set to the smallest value HTLC we will accept to process.
4048 * This value is sent to our counterparty on channel-open and we close the channel any time
4049 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
4051 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
4054 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
4057 * Set to the smallest value HTLC we will accept to process.
4059 * This value is sent to our counterparty on channel-open and we close the channel any time
4060 * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
4062 * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
4065 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
4067 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);
4069 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
4071 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_ptr);
4073 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
4076 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
4077 * only applies to inbound channels.
4081 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4084 * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
4085 * only applies to inbound channels.
4089 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4092 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
4093 * you to limit the maximum minimum-size they can require.
4095 * Default value: u64::max_value.
4097 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4100 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
4101 * you to limit the maximum minimum-size they can require.
4103 * Default value: u64::max_value.
4105 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4108 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
4109 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
4113 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4116 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
4117 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
4121 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4124 * The remote node will require we keep a certain amount in direct payment to ourselves at all
4125 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
4126 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
4128 * Default value: u64::max_value.
4130 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4133 * The remote node will require we keep a certain amount in direct payment to ourselves at all
4134 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
4135 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
4137 * Default value: u64::max_value.
4139 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4142 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
4143 * time. This allows you to set a minimum such value.
4147 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4150 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
4151 * time. This allows you to set a minimum such value.
4155 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
4158 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
4159 * required to always be higher than this value so this only applies to HTLC outputs (and
4160 * potentially to-self outputs before any payments have been made).
4161 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4162 * This setting allows you to set a minimum dust limit for their commitment transactions,
4163 * reflecting the reality that tiny outputs are not considered standard transactions and will
4164 * not propagate through the Bitcoin network.
4166 * Default value: 546, the current dust limit on the Bitcoin network.
4168 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4171 * Outputs below a certain value will not be added to on-chain transactions. The dust value is
4172 * required to always be higher than this value so this only applies to HTLC outputs (and
4173 * potentially to-self outputs before any payments have been made).
4174 * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4175 * This setting allows you to set a minimum dust limit for their commitment transactions,
4176 * reflecting the reality that tiny outputs are not considered standard transactions and will
4177 * not propagate through the Bitcoin network.
4179 * Default value: 546, the current dust limit on the Bitcoin network.
4181 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4184 * Maximum allowed threshold above which outputs will not be generated in their commitment
4186 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4188 * Default value: u64::max_value.
4190 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4193 * Maximum allowed threshold above which outputs will not be generated in their commitment
4195 * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
4197 * Default value: u64::max_value.
4199 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
4202 * Before a channel is usable the funding transaction will need to be confirmed by at least a
4203 * certain number of blocks, specified by the node which is not the funder (as the funder can
4204 * assume they aren't going to double-spend themselves).
4205 * This config allows you to set a limit on the maximum amount of time to wait.
4207 * Default value: 144, or roughly one day and only applies to outbound channels.
4209 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4212 * Before a channel is usable the funding transaction will need to be confirmed by at least a
4213 * certain number of blocks, specified by the node which is not the funder (as the funder can
4214 * assume they aren't going to double-spend themselves).
4215 * This config allows you to set a limit on the maximum amount of time to wait.
4217 * Default value: 144, or roughly one day and only applies to outbound channels.
4219 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
4222 * Set to force the incoming channel to match our announced channel preference in
4225 * Default value: true, to make the default that no announced channels are possible (which is
4226 * appropriate for any nodes which are not online very reliably).
4228 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4231 * Set to force the incoming channel to match our announced channel preference in
4234 * Default value: true, to make the default that no announced channels are possible (which is
4235 * appropriate for any nodes which are not online very reliably).
4237 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
4240 * Set to the amount of time we're willing to wait to claim money back to us.
4242 * Not checking this value would be a security issue, as our peer would be able to set it to
4243 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
4245 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
4246 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
4248 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
4251 * Set to the amount of time we're willing to wait to claim money back to us.
4253 * Not checking this value would be a security issue, as our peer would be able to set it to
4254 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
4256 * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value
4257 * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts)
4259 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
4261 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);
4263 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
4265 void ChannelConfig_free(struct LDKChannelConfig this_ptr);
4267 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
4270 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
4271 * This may be allowed to change at runtime in a later update, however doing so must result in
4272 * update messages sent to notify all nodes of our updated relay fee.
4276 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4279 * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
4280 * This may be allowed to change at runtime in a later update, however doing so must result in
4281 * update messages sent to notify all nodes of our updated relay fee.
4285 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
4288 * Set to announce the channel publicly and notify all nodes that they can route via this
4291 * This should only be set to true for nodes which expect to be online reliably.
4293 * As the node which funds a channel picks this value this will only apply for new outbound
4294 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
4296 * This cannot be changed after the initial channel handshake.
4298 * Default value: false.
4300 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4303 * Set to announce the channel publicly and notify all nodes that they can route via this
4306 * This should only be set to true for nodes which expect to be online reliably.
4308 * As the node which funds a channel picks this value this will only apply for new outbound
4309 * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
4311 * This cannot be changed after the initial channel handshake.
4313 * Default value: false.
4315 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
4318 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
4319 * supports it, they will then enforce the mutual-close output to us matches what we provided
4320 * at intialization, preventing us from closing to an alternate pubkey.
4322 * This is set to true by default to provide a slight increase in security, though ultimately
4323 * any attacker who is able to take control of a channel can just as easily send the funds via
4324 * lightning payments, so we never require that our counterparties support this option.
4326 * This cannot be changed after a channel has been initialized.
4328 * Default value: true.
4330 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
4333 * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
4334 * supports it, they will then enforce the mutual-close output to us matches what we provided
4335 * at intialization, preventing us from closing to an alternate pubkey.
4337 * This is set to true by default to provide a slight increase in security, though ultimately
4338 * any attacker who is able to take control of a channel can just as easily send the funds via
4339 * lightning payments, so we never require that our counterparties support this option.
4341 * This cannot be changed after a channel has been initialized.
4343 * Default value: true.
4345 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
4347 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
4349 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
4351 LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
4353 struct LDKChannelConfig ChannelConfig_read(struct LDKu8slice ser);
4355 void UserConfig_free(struct LDKUserConfig this_ptr);
4357 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
4360 * Channel config that we propose to our counterparty.
4362 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4365 * Channel config that we propose to our counterparty.
4367 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
4370 * Limits applied to our counterparty's proposed channel config settings.
4372 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4375 * Limits applied to our counterparty's proposed channel config settings.
4377 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
4380 * Channel config which affects behavior during channel lifetime.
4382 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
4385 * Channel config which affects behavior during channel lifetime.
4387 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
4389 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);
4391 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
4393 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
4396 * Calls the free function if one is set
4398 void Access_free(struct LDKAccess this_ptr);
4401 * Calls the free function if one is set
4403 void Watch_free(struct LDKWatch this_ptr);
4406 * Calls the free function if one is set
4408 void Filter_free(struct LDKFilter this_ptr);
4411 * Calls the free function if one is set
4413 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
4415 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
4418 * Calls the free function if one is set
4420 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
4422 void ChainMonitor_free(struct LDKChainMonitor this_ptr);
4425 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
4426 * of a channel and reacting accordingly based on transactions in the connected block. See
4427 * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
4428 * be returned by [`chain::Watch::release_pending_monitor_events`].
4430 * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
4431 * calls must not exclude any transactions matching the new outputs nor any in-block
4432 * descendants of such transactions. It is not necessary to re-fetch the block to obtain
4435 * [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected
4436 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
4437 * [`chain::Filter`]: ../trait.Filter.html
4439 void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
4442 * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
4443 * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
4446 * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected
4448 void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
4451 * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
4453 * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
4454 * will call back to it indicating transactions and outputs of interest. This allows clients to
4455 * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
4456 * always need to fetch full blocks absent another means for determining which blocks contain
4457 * transactions relevant to the watched channels.
4459 * [`chain::Filter`]: ../trait.Filter.html
4461 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
4463 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
4465 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
4467 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_ptr);
4469 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
4472 * The sequence number of this update. Updates *must* be replayed in-order according to this
4473 * sequence number (and updates may panic if they are not). The update_id values are strictly
4474 * increasing and increase by one for each new update, with one exception specified below.
4476 * This sequence number is also used to track up to which points updates which returned
4477 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4478 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4480 * The only instance where update_id values are not strictly increasing is the case where we
4481 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
4482 * its docs for more details.
4484 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
4486 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
4489 * The sequence number of this update. Updates *must* be replayed in-order according to this
4490 * sequence number (and updates may panic if they are not). The update_id values are strictly
4491 * increasing and increase by one for each new update, with one exception specified below.
4493 * This sequence number is also used to track up to which points updates which returned
4494 * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
4495 * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
4497 * The only instance where update_id values are not strictly increasing is the case where we
4498 * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
4499 * its docs for more details.
4501 * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html
4503 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
4505 LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
4507 LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
4509 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
4511 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_ptr);
4513 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
4515 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
4517 void HTLCUpdate_free(struct LDKHTLCUpdate this_ptr);
4519 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
4521 LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
4523 struct LDKHTLCUpdate HTLCUpdate_read(struct LDKu8slice ser);
4525 void ChannelMonitor_free(struct LDKChannelMonitor this_ptr);
4527 LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
4530 * Updates a ChannelMonitor on the basis of some new information provided by the Channel
4533 * panics if the given update is not the next update by update_id.
4535 MUST_USE_RES 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);
4538 * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
4541 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
4544 * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
4546 MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
4549 * Get the list of HTLCs who's status has been updated on chain. This should be called by
4550 * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
4552 * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events
4554 MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
4557 * Gets the list of pending events which were generated by previous actions, clearing the list
4560 * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
4561 * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
4562 * no internal locking in ChannelMonitors.
4564 MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct LDKChannelMonitor *NONNULL_PTR this_arg);
4567 * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
4568 * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
4569 * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
4570 * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
4571 * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
4572 * broadcast them if counterparty don't close channel with his higher commitment transaction after a
4573 * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
4574 * out-of-band the other node operator to coordinate with him if option is available to you.
4575 * In any-case, choice is up to the user.
4577 MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger);
4580 * Processes transactions in a newly connected block, which may result in any of the following:
4581 * - update the monitor's state against resolved HTLCs
4582 * - punish the counterparty in the case of seeing a revoked commitment transaction
4583 * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
4584 * - detect settled outputs for later spending
4585 * - schedule and bump any in-flight claims
4587 * Returns any new outputs to watch from `txdata`; after called, these are also included in
4588 * [`get_outputs_to_watch`].
4590 * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
4592 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);
4595 * Determines if the disconnected block contained any transactions of interest and updates
4598 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);
4601 * Calls the free function if one is set
4603 void Persist_free(struct LDKPersist this_ptr);
4605 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
4607 void OutPoint_free(struct LDKOutPoint this_ptr);
4609 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
4612 * The referenced transaction's txid.
4614 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
4617 * The referenced transaction's txid.
4619 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4622 * The index of the referenced output in its transaction's vout.
4624 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
4627 * The index of the referenced output in its transaction's vout.
4629 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
4631 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
4634 * Convert an `OutPoint` to a lightning channel id.
4636 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
4638 LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
4640 struct LDKOutPoint OutPoint_read(struct LDKu8slice ser);
4642 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
4644 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
4646 LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
4648 LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
4650 struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *NONNULL_PTR orig);
4653 * Calls the free function if one is set
4655 void ChannelKeys_free(struct LDKChannelKeys this_ptr);
4658 * Calls the free function if one is set
4660 void KeysInterface_free(struct LDKKeysInterface this_ptr);
4662 void InMemoryChannelKeys_free(struct LDKInMemoryChannelKeys this_ptr);
4664 struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *NONNULL_PTR orig);
4667 * Private key of anchor tx
4669 const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4672 * Private key of anchor tx
4674 void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4677 * Holder secret key for blinded revocation pubkey
4679 const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4682 * Holder secret key for blinded revocation pubkey
4684 void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4687 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4689 const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4692 * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
4694 void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4697 * Holder secret key used in HTLC tx
4699 const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4702 * Holder secret key used in HTLC tx
4704 void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4707 * Holder htlc secret key used in commitment tx htlc outputs
4709 const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4712 * Holder htlc secret key used in commitment tx htlc outputs
4714 void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val);
4719 const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32];
4724 void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4727 * Create a new InMemoryChannelKeys
4729 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);
4732 * Counterparty pubkeys.
4733 * Will panic if ready_channel wasn't called.
4735 MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4738 * The contest_delay value specified by our counterparty and applied on holder-broadcastable
4739 * transactions, ie the amount of time that we have to wait to recover our funds if we
4740 * broadcast a transaction.
4741 * Will panic if ready_channel wasn't called.
4743 MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4746 * The contest_delay value specified by us and applied on transactions broadcastable
4747 * by our counterparty, ie the amount of time that they have to wait to recover their funds
4748 * if they broadcast a transaction.
4749 * Will panic if ready_channel wasn't called.
4751 MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4754 * Whether the holder is the initiator
4755 * Will panic if ready_channel wasn't called.
4757 MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4761 * Will panic if ready_channel wasn't called.
4763 MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4766 * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
4767 * building transactions.
4769 * Will panic if ready_channel wasn't called.
4771 MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4773 struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg);
4775 LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj);
4777 LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser);
4779 void KeysManager_free(struct LDKKeysManager this_ptr);
4782 * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
4783 * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
4784 * starting_time isn't strictly required to actually be a time, but it must absolutely,
4785 * without a doubt, be unique to this instance. ie if you start multiple times with the same
4786 * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
4787 * simply use the current time (with very high precision).
4789 * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
4790 * obviously, starting_time should be unique every time you reload the library - it is only
4791 * used to generate new ephemeral key data (which will be stored by the individual channel if
4794 * Note that the seed is required to recover certain on-chain funds independent of
4795 * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
4796 * channel, and some on-chain during-closing funds.
4798 * Note that until the 0.1 release there is no guarantee of backward compatibility between
4799 * versions. Once the library is more fully supported, the docs will be updated to include a
4800 * detailed description of the guarantee.
4802 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);
4805 * Derive an old set of ChannelKeys for per-channel secrets based on a key derivation
4807 * Key derivation parameters are accessible through a per-channel secrets
4808 * ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of
4809 * onchain output detection for which a corresponding delayed_payment_key must be derived.
4811 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);
4813 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
4815 void ChannelManager_free(struct LDKChannelManager this_ptr);
4817 void ChannelDetails_free(struct LDKChannelDetails this_ptr);
4819 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
4822 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4823 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4824 * Note that this means this value is *not* persistent - it can change once during the
4825 * lifetime of the channel.
4827 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
4830 * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
4831 * thereafter this is the txid of the funding transaction xor the funding transaction output).
4832 * Note that this means this value is *not* persistent - it can change once during the
4833 * lifetime of the channel.
4835 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
4838 * The node_id of our counterparty
4840 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4843 * The node_id of our counterparty
4845 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
4848 * The Features the channel counterparty provided upon last connection.
4849 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4850 * many routing-relevant features are present in the init context.
4852 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4855 * The Features the channel counterparty provided upon last connection.
4856 * Useful for routing as it is the most up-to-date copy of the counterparty's features and
4857 * many routing-relevant features are present in the init context.
4859 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
4862 * The value, in satoshis, of this channel as appears in the funding output
4864 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4867 * The value, in satoshis, of this channel as appears in the funding output
4869 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4872 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4874 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4877 * The user_id passed in to create_channel, or 0 if the channel was inbound.
4879 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4882 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4883 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4884 * available for inclusion in new outbound HTLCs). This further does not include any pending
4885 * outgoing HTLCs which are awaiting some other resolution to be sent.
4887 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4890 * The available outbound capacity for sending HTLCs to the remote peer. This does not include
4891 * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4892 * available for inclusion in new outbound HTLCs). This further does not include any pending
4893 * outgoing HTLCs which are awaiting some other resolution to be sent.
4895 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4898 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4899 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4900 * available for inclusion in new inbound HTLCs).
4901 * Note that there are some corner cases not fully handled here, so the actual available
4902 * inbound capacity may be slightly higher than this.
4904 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4907 * The available inbound capacity for the remote peer to send HTLCs to us. This does not
4908 * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
4909 * available for inclusion in new inbound HTLCs).
4910 * Note that there are some corner cases not fully handled here, so the actual available
4911 * inbound capacity may be slightly higher than this.
4913 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
4916 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4917 * the peer is connected, and (c) no monitor update failure is pending resolution.
4919 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
4922 * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
4923 * the peer is connected, and (c) no monitor update failure is pending resolution.
4925 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
4927 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
4930 * Constructs a new ChannelManager to hold several channels and route between them.
4932 * This is the main \"logic hub\" for all channel-related actions, and implements
4933 * ChannelMessageHandler.
4935 * Non-proportional fees are fixed according to our risk using the provided fee estimator.
4937 * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
4939 * Users must provide the current blockchain height from which to track onchain channel
4940 * funding outpoints and send payments with reliable timelocks.
4942 * Users need to notify the new ChannelManager when a new block is connected or
4943 * disconnected using its `block_connected` and `block_disconnected` methods.
4945 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);
4948 * Creates a new outbound channel to the given remote node and with the given value.
4950 * user_id will be provided back as user_channel_id in FundingGenerationReady and
4951 * FundingBroadcastSafe events to allow tracking of which events correspond with which
4952 * create_channel call. Note that user_channel_id defaults to 0 for inbound channels, so you
4953 * may wish to avoid using 0 for user_id here.
4955 * If successful, will generate a SendOpenChannel message event, so you should probably poll
4956 * PeerManager::process_events afterwards.
4958 * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
4959 * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
4961 MUST_USE_RES 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);
4964 * Gets the list of open channels, in random order. See ChannelDetail field documentation for
4967 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4970 * Gets the list of usable channels, in random order. Useful as an argument to
4971 * get_route to ensure non-announced channels are used.
4973 * These are guaranteed to have their is_live value set to true, see the documentation for
4974 * ChannelDetails::is_live for more info on exactly what the criteria are.
4976 MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
4979 * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
4980 * will be accepted on the given channel, and after additional timeout/the closing of all
4981 * pending HTLCs, the channel will be closed on chain.
4983 * May generate a SendShutdown message event on success, which should be relayed.
4985 MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
4988 * Force closes a channel, immediately broadcasting the latest local commitment transaction to
4989 * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
4991 MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
4994 * Force close all channels, immediately broadcasting the latest local commitment transaction
4995 * for each to the chain and rejecting new HTLCs on each.
4997 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
5000 * Sends a payment along a given route.
5002 * Value parameters are provided via the last hop in route, see documentation for RouteHop
5003 * fields for more info.
5005 * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
5006 * payment), we don't do anything to stop you! We always try to ensure that if the provided
5007 * next hop knows the preimage to payment_hash they can claim an additional amount as
5008 * specified in the last hop in the route! Thus, you should probably do your own
5009 * payment_preimage tracking (which you should already be doing as they represent \"proof of
5010 * payment\") and prevent double-sends yourself.
5012 * May generate SendHTLCs message(s) event on success, which should be relayed.
5014 * Each path may have a different return value, and PaymentSendValue may return a Vec with
5015 * each entry matching the corresponding-index entry in the route paths, see
5016 * PaymentSendFailure for more info.
5018 * In general, a path may raise:
5019 * * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
5020 * node public key) is specified.
5021 * * APIError::ChannelUnavailable if the next-hop channel is not available for updates
5022 * (including due to previous monitor update failure or new permanent monitor update
5024 * * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
5027 * Note that depending on the type of the PaymentSendFailure the HTLC may have been
5028 * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
5029 * different route unless you intend to pay twice!
5031 * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
5032 * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
5033 * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
5034 * must not contain multiple paths as multi-path payments require a recipient-provided
5036 * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
5037 * bit set (either as required or as available). If multiple paths are present in the Route,
5038 * we assume the invoice had the basic_mpp feature set.
5040 MUST_USE_RES 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);
5043 * Call this upon creation of a funding transaction for the given channel.
5045 * Note that ALL inputs in the transaction pointed to by funding_txo MUST spend SegWit outputs
5046 * or your counterparty can steal your funds!
5048 * Panics if a funding transaction has already been provided for this channel.
5050 * May panic if the funding_txo is duplicative with some other channel (note that this should
5051 * be trivially prevented by using unique funding transaction keys per-channel).
5053 void ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKOutPoint funding_txo);
5056 * Generates a signed node_announcement from the given arguments and creates a
5057 * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
5058 * seen a channel_announcement from us (ie unless we have public channels open).
5060 * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
5061 * to humans. They carry no in-protocol meaning.
5063 * addresses represent the set (possibly empty) of socket addresses on which this node accepts
5064 * incoming connections. These will be broadcast to the network, publicly tying these
5065 * addresses together. If you wish to preserve user privacy, addresses should likely contain
5066 * only Tor Onion addresses.
5068 * Panics if addresses is absurdly large (more than 500).
5070 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, LDKCVec_NetAddressZ addresses);
5073 * Processes HTLCs which are pending waiting on random forward delay.
5075 * Should only really ever be called in response to a PendingHTLCsForwardable event.
5076 * Will likely generate further events.
5078 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
5081 * If a peer is disconnected we mark any channels with that peer as 'disabled'.
5082 * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
5083 * to inform the network about the uselessness of these channels.
5085 * This method handles all the details, and must be called roughly once per minute.
5087 void ChannelManager_timer_chan_freshness_every_min(const struct LDKChannelManager *NONNULL_PTR this_arg);
5090 * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
5091 * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
5092 * along the path (including in our own channel on which we received it).
5093 * Returns false if no payment was found to fail backwards, true if the process of failing the
5094 * HTLC backwards has been started.
5096 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);
5099 * Provides a payment preimage in response to a PaymentReceived event, returning true and
5100 * generating message events for the net layer to claim the payment, if possible. Thus, you
5101 * should probably kick the net layer to go send messages if this returns true!
5103 * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
5104 * available within a few percent of the expected amount. This is critical for several
5105 * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
5106 * payment_preimage without having provided the full value and b) it avoids certain
5107 * privacy-breaking recipient-probing attacks which may reveal payment activity to
5108 * motivated attackers.
5110 * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
5111 * set. Thus, for such payments we will claim any payments which do not under-pay.
5113 * May panic if called except in response to a PaymentReceived event.
5115 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);
5118 * Gets the node_id held by this ChannelManager
5120 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
5123 * Restores a single, given channel to normal operation after a
5124 * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
5127 * All ChannelMonitor updates up to and including highest_applied_update_id must have been
5128 * fully committed in every copy of the given channels' ChannelMonitors.
5130 * Note that there is no effect to calling with a highest_applied_update_id other than the
5131 * current latest ChannelMonitorUpdate and one call to this function after multiple
5132 * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
5133 * exists largely only to prevent races between this and concurrent update_monitor calls.
5135 * Thus, the anticipated use is, at a high level:
5136 * 1) You register a chain::Watch with this ChannelManager,
5137 * 2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
5138 * said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
5139 * any time it cannot do so instantly,
5140 * 3) update(s) are applied to each remote copy of a ChannelMonitor,
5141 * 4) once all remote copies are updated, you call this function with the update_id that
5142 * completed, and once it is the latest the Channel will be re-enabled.
5144 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);
5146 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
5148 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
5151 * Updates channel state based on transactions seen in a connected block.
5153 void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
5156 * Updates channel state based on a disconnected block.
5158 * If necessary, the channel may be force-closed without letting the counterparty participate
5161 void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]);
5163 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
5165 LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
5167 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_ptr);
5170 * The keys provider which will give us relevant keys. Some keys will be loaded during
5171 * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
5174 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5177 * The keys provider which will give us relevant keys. Some keys will be loaded during
5178 * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
5181 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
5184 * The fee_estimator for use in the ChannelManager in the future.
5186 * No calls to the FeeEstimator will be made during deserialization.
5188 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5191 * The fee_estimator for use in the ChannelManager in the future.
5193 * No calls to the FeeEstimator will be made during deserialization.
5195 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
5198 * The chain::Watch for use in the ChannelManager in the future.
5200 * No calls to the chain::Watch will be made during deserialization. It is assumed that
5201 * you have deserialized ChannelMonitors separately and will add them to your
5202 * chain::Watch after deserializing this ChannelManager.
5204 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5207 * The chain::Watch for use in the ChannelManager in the future.
5209 * No calls to the chain::Watch will be made during deserialization. It is assumed that
5210 * you have deserialized ChannelMonitors separately and will add them to your
5211 * chain::Watch after deserializing this ChannelManager.
5213 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
5216 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
5217 * used to broadcast the latest local commitment transactions of channels which must be
5218 * force-closed during deserialization.
5220 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5223 * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
5224 * used to broadcast the latest local commitment transactions of channels which must be
5225 * force-closed during deserialization.
5227 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
5230 * The Logger for use in the ChannelManager and which may be used to log information during
5233 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5236 * The Logger for use in the ChannelManager and which may be used to log information during
5239 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
5242 * Default settings used for new channels. Any existing channels will continue to use the
5243 * runtime settings which were stored when the ChannelManager was serialized.
5245 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
5248 * Default settings used for new channels. Any existing channels will continue to use the
5249 * runtime settings which were stored when the ChannelManager was serialized.
5251 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
5254 * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
5255 * HashMap for you. This is primarily useful for C bindings where it is not practical to
5256 * populate a HashMap directly from C.
5258 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);
5260 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
5262 void DecodeError_free(struct LDKDecodeError this_ptr);
5264 void Init_free(struct LDKInit this_ptr);
5266 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
5268 void ErrorMessage_free(struct LDKErrorMessage this_ptr);
5270 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
5273 * The channel ID involved in the error
5275 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
5278 * The channel ID involved in the error
5280 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5283 * A possibly human-readable error description.
5284 * The string should be sanitized before it is used (e.g. emitted to logs
5285 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
5286 * vulnerability in the terminal emulator or the logging subsystem.
5288 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
5291 * A possibly human-readable error description.
5292 * The string should be sanitized before it is used (e.g. emitted to logs
5293 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
5294 * vulnerability in the terminal emulator or the logging subsystem.
5296 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, LDKCVec_u8Z val);
5298 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z data_arg);
5300 void Ping_free(struct LDKPing this_ptr);
5302 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
5305 * The desired response length
5307 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
5310 * The desired response length
5312 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
5315 * The ping packet size.
5316 * This field is not sent on the wire. byteslen zeros are sent.
5318 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
5321 * The ping packet size.
5322 * This field is not sent on the wire. byteslen zeros are sent.
5324 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
5326 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
5328 void Pong_free(struct LDKPong this_ptr);
5330 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
5333 * The pong packet size.
5334 * This field is not sent on the wire. byteslen zeros are sent.
5336 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
5339 * The pong packet size.
5340 * This field is not sent on the wire. byteslen zeros are sent.
5342 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
5344 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
5346 void OpenChannel_free(struct LDKOpenChannel this_ptr);
5348 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
5351 * The genesis hash of the blockchain where the channel is to be opened
5353 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
5356 * The genesis hash of the blockchain where the channel is to be opened
5358 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5361 * A temporary channel ID, until the funding outpoint is announced
5363 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
5366 * A temporary channel ID, until the funding outpoint is announced
5368 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5373 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5378 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5381 * The amount to push to the counterparty as part of the open, in milli-satoshi
5383 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5386 * The amount to push to the counterparty as part of the open, in milli-satoshi
5388 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5391 * The threshold below which outputs on transactions broadcast by sender will be omitted
5393 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5396 * The threshold below which outputs on transactions broadcast by sender will be omitted
5398 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5401 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5403 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5406 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5408 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5411 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5413 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5416 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5418 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5421 * The minimum HTLC size incoming to sender, in milli-satoshi
5423 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5426 * The minimum HTLC size incoming to sender, in milli-satoshi
5428 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
5431 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
5433 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5436 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
5438 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
5441 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5443 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5446 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5448 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
5451 * The maximum number of inbound HTLCs towards sender
5453 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5456 * The maximum number of inbound HTLCs towards sender
5458 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
5461 * The sender's key controlling the funding transaction
5463 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5466 * The sender's key controlling the funding transaction
5468 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5471 * Used to derive a revocation key for transactions broadcast by counterparty
5473 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5476 * Used to derive a revocation key for transactions broadcast by counterparty
5478 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5481 * A payment key to sender for transactions broadcast by counterparty
5483 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5486 * A payment key to sender for transactions broadcast by counterparty
5488 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5491 * Used to derive a payment key to sender for transactions broadcast by sender
5493 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5496 * Used to derive a payment key to sender for transactions broadcast by sender
5498 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5501 * Used to derive an HTLC payment key to sender
5503 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5506 * Used to derive an HTLC payment key to sender
5508 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5511 * The first to-be-broadcast-by-sender transaction's per commitment point
5513 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5516 * The first to-be-broadcast-by-sender transaction's per commitment point
5518 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5523 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
5528 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
5530 void AcceptChannel_free(struct LDKAcceptChannel this_ptr);
5532 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
5535 * A temporary channel ID, until the funding outpoint is announced
5537 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
5540 * A temporary channel ID, until the funding outpoint is announced
5542 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5545 * The threshold below which outputs on transactions broadcast by sender will be omitted
5547 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5550 * The threshold below which outputs on transactions broadcast by sender will be omitted
5552 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5555 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5557 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5560 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
5562 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5565 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5567 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5570 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
5572 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5575 * The minimum HTLC size incoming to sender, in milli-satoshi
5577 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5580 * The minimum HTLC size incoming to sender, in milli-satoshi
5582 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
5585 * Minimum depth of the funding transaction before the channel is considered open
5587 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5590 * Minimum depth of the funding transaction before the channel is considered open
5592 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
5595 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5597 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5600 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
5602 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
5605 * The maximum number of inbound HTLCs towards sender
5607 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5610 * The maximum number of inbound HTLCs towards sender
5612 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
5615 * The sender's key controlling the funding transaction
5617 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5620 * The sender's key controlling the funding transaction
5622 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5625 * Used to derive a revocation key for transactions broadcast by counterparty
5627 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5630 * Used to derive a revocation key for transactions broadcast by counterparty
5632 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5635 * A payment key to sender for transactions broadcast by counterparty
5637 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5640 * A payment key to sender for transactions broadcast by counterparty
5642 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5645 * Used to derive a payment key to sender for transactions broadcast by sender
5647 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5650 * Used to derive a payment key to sender for transactions broadcast by sender
5652 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5655 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
5657 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5660 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
5662 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5665 * The first to-be-broadcast-by-sender transaction's per commitment point
5667 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
5670 * The first to-be-broadcast-by-sender transaction's per commitment point
5672 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5674 void FundingCreated_free(struct LDKFundingCreated this_ptr);
5676 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
5679 * A temporary channel ID, until the funding is established
5681 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
5684 * A temporary channel ID, until the funding is established
5686 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5689 * The funding transaction ID
5691 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
5694 * The funding transaction ID
5696 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5699 * The specific output index funding this channel
5701 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
5704 * The specific output index funding this channel
5706 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
5709 * The signature of the channel initiator (funder) on the funding transaction
5711 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
5714 * The signature of the channel initiator (funder) on the funding transaction
5716 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
5718 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);
5720 void FundingSigned_free(struct LDKFundingSigned this_ptr);
5722 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
5727 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
5732 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5735 * The signature of the channel acceptor (fundee) on the funding transaction
5737 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
5740 * The signature of the channel acceptor (fundee) on the funding transaction
5742 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5744 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
5746 void FundingLocked_free(struct LDKFundingLocked this_ptr);
5748 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
5753 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
5758 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5761 * The per-commitment point of the second commitment transaction
5763 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
5766 * The per-commitment point of the second commitment transaction
5768 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
5770 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
5772 void Shutdown_free(struct LDKShutdown this_ptr);
5774 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
5779 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
5784 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5787 * The destination of this peer's funds on closing.
5788 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5790 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
5793 * The destination of this peer's funds on closing.
5794 * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
5796 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, LDKCVec_u8Z val);
5798 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z scriptpubkey_arg);
5800 void ClosingSigned_free(struct LDKClosingSigned this_ptr);
5802 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
5807 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
5812 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5815 * The proposed total fee for the closing transaction
5817 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
5820 * The proposed total fee for the closing transaction
5822 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
5825 * A signature on the closing transaction
5827 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
5830 * A signature on the closing transaction
5832 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
5834 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
5836 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_ptr);
5838 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
5843 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
5848 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5853 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5858 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
5861 * The HTLC value in milli-satoshi
5863 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5866 * The HTLC value in milli-satoshi
5868 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
5871 * The payment hash, the pre-image of which controls HTLC redemption
5873 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
5876 * The payment hash, the pre-image of which controls HTLC redemption
5878 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5881 * The expiry height of the HTLC
5883 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
5886 * The expiry height of the HTLC
5888 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
5890 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_ptr);
5892 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
5897 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
5902 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5907 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
5912 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
5915 * The pre-image of the payment hash, allowing HTLC redemption
5917 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
5920 * The pre-image of the payment hash, allowing HTLC redemption
5922 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5924 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
5926 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_ptr);
5928 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
5933 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
5938 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5943 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
5948 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
5950 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_ptr);
5952 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
5957 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
5962 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5967 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
5972 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
5977 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
5982 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
5984 void CommitmentSigned_free(struct LDKCommitmentSigned this_ptr);
5986 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
5991 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
5996 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
5999 * A signature on the commitment transaction
6001 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
6004 * A signature on the commitment transaction
6006 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
6009 * Signatures on the HTLC transactions
6011 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, LDKCVec_SignatureZ val);
6013 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, LDKCVec_SignatureZ htlc_signatures_arg);
6015 void RevokeAndACK_free(struct LDKRevokeAndACK this_ptr);
6017 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
6022 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
6027 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6030 * The secret corresponding to the per-commitment point
6032 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
6035 * The secret corresponding to the per-commitment point
6037 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6040 * The next sender-broadcast commitment transaction's per-commitment point
6042 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
6045 * The next sender-broadcast commitment transaction's per-commitment point
6047 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6049 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);
6051 void UpdateFee_free(struct LDKUpdateFee this_ptr);
6053 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
6058 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
6063 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6066 * Fee rate per 1000-weight of the transaction
6068 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
6071 * Fee rate per 1000-weight of the transaction
6073 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
6075 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
6077 void DataLossProtect_free(struct LDKDataLossProtect this_ptr);
6079 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
6082 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
6083 * belonging to the recipient
6085 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
6088 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
6089 * belonging to the recipient
6091 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6094 * The sender's per-commitment point for their current commitment transaction
6096 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
6099 * The sender's per-commitment point for their current commitment transaction
6101 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6103 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
6105 void ChannelReestablish_free(struct LDKChannelReestablish this_ptr);
6107 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
6112 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
6117 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6120 * The next commitment number for the sender
6122 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
6125 * The next commitment number for the sender
6127 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
6130 * The next commitment number for the recipient
6132 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
6135 * The next commitment number for the recipient
6137 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
6139 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_ptr);
6141 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
6146 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
6151 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6154 * The short channel ID
6156 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6159 * The short channel ID
6161 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
6164 * A signature by the node key
6166 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6169 * A signature by the node key
6171 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
6174 * A signature by the funding key
6176 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
6179 * A signature by the funding key
6181 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
6183 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);
6185 void NetAddress_free(struct LDKNetAddress this_ptr);
6187 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
6189 LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
6191 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
6193 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_ptr);
6195 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
6198 * The advertised features
6200 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6203 * The advertised features
6205 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
6208 * A strictly monotonic announcement counter, with gaps allowed
6210 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6213 * A strictly monotonic announcement counter, with gaps allowed
6215 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
6218 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
6221 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
6224 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
6227 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6230 * An RGB color for UI purposes
6232 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
6235 * An RGB color for UI purposes
6237 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
6240 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
6243 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
6246 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
6249 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6252 * List of addresses on which this node is reachable
6254 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, LDKCVec_NetAddressZ val);
6256 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_ptr);
6258 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
6261 * The signature by the node key
6263 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
6266 * The signature by the node key
6268 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6271 * The actual content of the announcement
6273 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
6276 * The actual content of the announcement
6278 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
6280 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
6282 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_ptr);
6284 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
6287 * The advertised channel features
6289 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6292 * The advertised channel features
6294 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
6297 * The genesis hash of the blockchain where the channel is to be opened
6299 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
6302 * The genesis hash of the blockchain where the channel is to be opened
6304 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6307 * The short channel ID
6309 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6312 * The short channel ID
6314 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
6317 * One of the two node_ids which are endpoints of this channel
6319 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6322 * One of the two node_ids which are endpoints of this channel
6324 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6327 * The other of the two node_ids which are endpoints of this channel
6329 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6332 * The other of the two node_ids which are endpoints of this channel
6334 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6337 * The funding key for the first node
6339 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6342 * The funding key for the first node
6344 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6347 * The funding key for the second node
6349 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
6352 * The funding key for the second node
6354 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
6356 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_ptr);
6358 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
6361 * Authentication of the announcement by the first public node
6363 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6366 * Authentication of the announcement by the first public node
6368 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6371 * Authentication of the announcement by the second public node
6373 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6376 * Authentication of the announcement by the second public node
6378 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6381 * Proof of funding UTXO ownership by the first public node
6383 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6386 * Proof of funding UTXO ownership by the first public node
6388 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6391 * Proof of funding UTXO ownership by the second public node
6393 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6396 * Proof of funding UTXO ownership by the second public node
6398 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
6401 * The actual announcement
6403 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
6406 * The actual announcement
6408 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
6410 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);
6412 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_ptr);
6414 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
6417 * The genesis hash of the blockchain where the channel is to be opened
6419 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
6422 * The genesis hash of the blockchain where the channel is to be opened
6424 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6427 * The short channel ID
6429 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6432 * The short channel ID
6434 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
6437 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
6439 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6442 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
6444 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6449 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6454 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
6457 * The number of blocks to subtract from incoming HTLC cltv_expiry values
6459 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6462 * The number of blocks to subtract from incoming HTLC cltv_expiry values
6464 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
6467 * The minimum HTLC size incoming to sender, in milli-satoshi
6469 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6472 * The minimum HTLC size incoming to sender, in milli-satoshi
6474 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
6477 * The base HTLC fee charged by sender, in milli-satoshi
6479 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6482 * The base HTLC fee charged by sender, in milli-satoshi
6484 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6487 * The amount to fee multiplier, in micro-satoshi
6489 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
6492 * The amount to fee multiplier, in micro-satoshi
6494 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
6496 void ChannelUpdate_free(struct LDKChannelUpdate this_ptr);
6498 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
6501 * A signature of the channel update
6503 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
6506 * A signature of the channel update
6508 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
6511 * The actual channel update
6513 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
6516 * The actual channel update
6518 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
6520 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
6522 void QueryChannelRange_free(struct LDKQueryChannelRange this_ptr);
6524 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
6527 * The genesis hash of the blockchain being queried
6529 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
6532 * The genesis hash of the blockchain being queried
6534 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6537 * The height of the first block for the channel UTXOs being queried
6539 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
6542 * The height of the first block for the channel UTXOs being queried
6544 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6547 * The number of blocks to include in the query results
6549 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
6552 * The number of blocks to include in the query results
6554 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6556 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
6558 void ReplyChannelRange_free(struct LDKReplyChannelRange this_ptr);
6560 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
6563 * The genesis hash of the blockchain being queried
6565 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
6568 * The genesis hash of the blockchain being queried
6570 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6573 * The height of the first block in the range of the reply
6575 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6578 * The height of the first block in the range of the reply
6580 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6583 * The number of blocks included in the range of the reply
6585 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6588 * The number of blocks included in the range of the reply
6590 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
6593 * Indicates if the query recipient maintains up-to-date channel
6594 * information for the chain_hash
6596 bool ReplyChannelRange_get_full_information(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
6599 * Indicates if the query recipient maintains up-to-date channel
6600 * information for the chain_hash
6602 void ReplyChannelRange_set_full_information(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
6605 * The short_channel_ids in the channel range
6607 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, LDKCVec_u64Z val);
6609 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);
6611 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_ptr);
6613 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
6616 * The genesis hash of the blockchain being queried
6618 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
6621 * The genesis hash of the blockchain being queried
6623 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6626 * The short_channel_ids that are being queried
6628 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, LDKCVec_u64Z val);
6630 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, LDKCVec_u64Z short_channel_ids_arg);
6632 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_ptr);
6634 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
6637 * The genesis hash of the blockchain that was queried
6639 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
6642 * The genesis hash of the blockchain that was queried
6644 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6647 * Indicates if the query recipient maintains up-to-date channel
6648 * information for the chain_hash
6650 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
6653 * Indicates if the query recipient maintains up-to-date channel
6654 * information for the chain_hash
6656 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
6658 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
6660 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_ptr);
6662 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
6665 * The genesis hash of the blockchain for channel and node information
6667 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
6670 * The genesis hash of the blockchain for channel and node information
6672 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
6675 * The starting unix timestamp
6677 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
6680 * The starting unix timestamp
6682 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
6685 * The range of information in seconds
6687 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
6690 * The range of information in seconds
6692 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
6694 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
6696 void ErrorAction_free(struct LDKErrorAction this_ptr);
6698 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
6700 void LightningError_free(struct LDKLightningError this_ptr);
6703 * A human-readable message describing the error
6705 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
6708 * A human-readable message describing the error
6710 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, LDKCVec_u8Z val);
6713 * The action which should be taken against the offending peer.
6715 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
6718 * The action which should be taken against the offending peer.
6720 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
6722 MUST_USE_RES struct LDKLightningError LightningError_new(LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
6724 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_ptr);
6726 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
6729 * update_add_htlc messages which should be sent
6731 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateAddHTLCZ val);
6734 * update_fulfill_htlc messages which should be sent
6736 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFulfillHTLCZ val);
6739 * update_fail_htlc messages which should be sent
6741 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFailHTLCZ val);
6744 * update_fail_malformed_htlc messages which should be sent
6746 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFailMalformedHTLCZ val);
6749 * An update_fee message which should be sent
6751 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
6754 * An update_fee message which should be sent
6756 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
6759 * Finally, the commitment_signed message which should be sent
6761 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
6764 * Finally, the commitment_signed message which should be sent
6766 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
6768 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);
6770 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
6772 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
6775 * Calls the free function if one is set
6777 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
6780 * Calls the free function if one is set
6782 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
6784 LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
6786 struct LDKAcceptChannel AcceptChannel_read(struct LDKu8slice ser);
6788 LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
6790 struct LDKAnnouncementSignatures AnnouncementSignatures_read(struct LDKu8slice ser);
6792 LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
6794 LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
6796 LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
6798 struct LDKClosingSigned ClosingSigned_read(struct LDKu8slice ser);
6800 LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
6802 struct LDKCommitmentSigned CommitmentSigned_read(struct LDKu8slice ser);
6804 LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
6806 struct LDKFundingCreated FundingCreated_read(struct LDKu8slice ser);
6808 LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
6810 struct LDKFundingSigned FundingSigned_read(struct LDKu8slice ser);
6812 LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
6814 struct LDKFundingLocked FundingLocked_read(struct LDKu8slice ser);
6816 LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
6818 LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
6820 LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
6822 struct LDKOpenChannel OpenChannel_read(struct LDKu8slice ser);
6824 LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
6826 struct LDKRevokeAndACK RevokeAndACK_read(struct LDKu8slice ser);
6828 LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
6830 struct LDKShutdown Shutdown_read(struct LDKu8slice ser);
6832 LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
6834 struct LDKUpdateFailHTLC UpdateFailHTLC_read(struct LDKu8slice ser);
6836 LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
6838 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
6840 LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
6842 struct LDKUpdateFee UpdateFee_read(struct LDKu8slice ser);
6844 LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
6846 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(struct LDKu8slice ser);
6848 LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
6850 struct LDKUpdateAddHTLC UpdateAddHTLC_read(struct LDKu8slice ser);
6852 LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
6854 LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
6856 LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
6858 LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
6860 LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
6862 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
6864 LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
6866 struct LDKChannelAnnouncement ChannelAnnouncement_read(struct LDKu8slice ser);
6868 LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
6870 LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
6872 LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
6874 struct LDKChannelUpdate ChannelUpdate_read(struct LDKu8slice ser);
6876 LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
6878 LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
6880 LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
6882 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
6884 LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
6886 struct LDKNodeAnnouncement NodeAnnouncement_read(struct LDKu8slice ser);
6888 LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
6890 LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
6892 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
6894 LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
6896 LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
6898 LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
6900 LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
6902 LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
6904 LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
6906 LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
6908 void MessageHandler_free(struct LDKMessageHandler this_ptr);
6911 * A message handler which handles messages specific to channels. Usually this is just a
6912 * ChannelManager object.
6914 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
6917 * A message handler which handles messages specific to channels. Usually this is just a
6918 * ChannelManager object.
6920 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
6923 * A message handler which handles messages updating our knowledge of the network channel
6924 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6926 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
6929 * A message handler which handles messages updating our knowledge of the network channel
6930 * graph. Usually this is just a NetGraphMsgHandlerMonitor object.
6932 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
6934 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
6936 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
6939 * Calls the free function if one is set
6941 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
6943 void PeerHandleError_free(struct LDKPeerHandleError this_ptr);
6946 * Used to indicate that we probably can't make any future connections to this peer, implying
6947 * we should go ahead and force-close any channels we have with it.
6949 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
6952 * Used to indicate that we probably can't make any future connections to this peer, implying
6953 * we should go ahead and force-close any channels we have with it.
6955 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
6957 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
6959 void PeerManager_free(struct LDKPeerManager this_ptr);
6962 * Constructs a new PeerManager with the given message handlers and node_id secret key
6963 * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
6964 * cryptographically secure random bytes.
6966 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);
6969 * Get the list of node ids for peers which have completed the initial handshake.
6971 * For outbound connections, this will be the same as the their_node_id parameter passed in to
6972 * new_outbound_connection, however entries will only appear once the initial handshake has
6973 * completed and we are sure the remote peer has the private key for the given node_id.
6975 MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
6978 * Indicates a new outbound connection has been established to a node with the given node_id.
6979 * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
6980 * descriptor but must disconnect the connection immediately.
6982 * Returns a small number of bytes to send to the remote node (currently always 50).
6984 * Panics if descriptor is duplicative with some other descriptor which has not yet had a
6985 * socket_disconnected().
6987 MUST_USE_RES LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor);
6990 * Indicates a new inbound connection has been established.
6992 * May refuse the connection by returning an Err, but will never write bytes to the remote end
6993 * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
6994 * call socket_disconnected for the new descriptor but must disconnect the connection
6997 * Panics if descriptor is duplicative with some other descriptor which has not yet had
6998 * socket_disconnected called.
7000 MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
7003 * Indicates that there is room to write data to the given socket descriptor.
7005 * May return an Err to indicate that the connection should be closed.
7007 * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
7008 * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
7009 * invariants around calling write_buffer_space_avail in case a write did not fully complete
7010 * must still hold - be ready to call write_buffer_space_avail again if a write call generated
7011 * here isn't sufficient! Panics if the descriptor was not previously registered in a
7012 * new_\\*_connection event.
7014 MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
7017 * Indicates that data was read from the given socket descriptor.
7019 * May return an Err to indicate that the connection should be closed.
7021 * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
7022 * Thus, however, you almost certainly want to call process_events() after any read_event to
7023 * generate send_data calls to handle responses.
7025 * If Ok(true) is returned, further read_events should not be triggered until a send_data call
7026 * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
7028 * Panics if the descriptor was not previously registered in a new_*_connection event.
7030 MUST_USE_RES LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data);
7033 * Checks for any events generated by our handlers and processes them. Includes sending most
7034 * response messages as well as messages generated by calls to handler functions directly (eg
7035 * functions like ChannelManager::process_pending_htlc_forward or send_payment).
7037 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
7040 * Indicates that the given socket descriptor's connection is now closed.
7042 * This must only be called if the socket has been disconnected by the peer or your own
7043 * decision to disconnect it and must NOT be called in any case where other parts of this
7044 * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
7047 * Panics if the descriptor was not previously registered in a successful new_*_connection event.
7049 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
7052 * Disconnect a peer given its node id.
7054 * Set no_connection_possible to true to prevent any further connection with this peer,
7055 * force-closing any channels we have with it.
7057 * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
7058 * so be careful about reentrancy issues.
7060 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
7063 * This function should be called roughly once every 30 seconds.
7064 * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
7065 * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
7067 void PeerManager_timer_tick_occured(const struct LDKPeerManager *NONNULL_PTR this_arg);
7070 * Build the commitment secret from the seed and the commitment number
7072 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
7075 * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
7076 * from the base secret and the per_commitment_point.
7078 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7079 * generated (ie our own).
7081 LDKCResult_SecretKeySecpErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
7084 * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
7085 * from the base point and the per_commitment_key. This is the public equivalent of
7086 * derive_private_key - using only public keys to derive a public key instead of private keys.
7088 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7089 * generated (ie our own).
7091 LDKCResult_PublicKeySecpErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
7094 * Derives a per-commitment-transaction revocation key from its constituent parts.
7096 * Only the cheating participant owns a valid witness to propagate a revoked
7097 * commitment transaction, thus per_commitment_secret always come from cheater
7098 * and revocation_base_secret always come from punisher, which is the broadcaster
7099 * of the transaction spending with this key knowledge.
7101 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7102 * generated (ie our own).
7104 LDKCResult_SecretKeySecpErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
7107 * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
7108 * the public equivalend of derive_private_revocation_key - using only public keys to derive a
7109 * public key instead of private keys.
7111 * Only the cheating participant owns a valid witness to propagate a revoked
7112 * commitment transaction, thus per_commitment_point always come from cheater
7113 * and revocation_base_point always come from punisher, which is the broadcaster
7114 * of the transaction spending with this key knowledge.
7116 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
7117 * generated (ie our own).
7119 LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
7121 void TxCreationKeys_free(struct LDKTxCreationKeys this_ptr);
7123 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
7126 * The broadcaster's per-commitment public key which was used to derive the other keys.
7128 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7131 * The broadcaster's per-commitment public key which was used to derive the other keys.
7133 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7136 * The revocation key which is used to allow the broadcaster of the commitment
7137 * transaction to provide their counterparty the ability to punish them if they broadcast
7140 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7143 * The revocation key which is used to allow the broadcaster of the commitment
7144 * transaction to provide their counterparty the ability to punish them if they broadcast
7147 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7150 * Broadcaster's HTLC Key
7152 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7155 * Broadcaster's HTLC Key
7157 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7160 * Countersignatory's HTLC Key
7162 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7165 * Countersignatory's HTLC Key
7167 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7170 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
7172 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
7175 * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
7177 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7179 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);
7181 LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
7183 struct LDKTxCreationKeys TxCreationKeys_read(struct LDKu8slice ser);
7185 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_ptr);
7187 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
7190 * The public key which is used to sign all commitment transactions, as it appears in the
7191 * on-chain channel lock-in 2-of-2 multisig output.
7193 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7196 * The public key which is used to sign all commitment transactions, as it appears in the
7197 * on-chain channel lock-in 2-of-2 multisig output.
7199 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7202 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
7203 * revocation keys. This is combined with the per-commitment-secret generated by the
7204 * counterparty to create a secret which the counterparty can reveal to revoke previous
7207 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7210 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
7211 * revocation keys. This is combined with the per-commitment-secret generated by the
7212 * counterparty to create a secret which the counterparty can reveal to revoke previous
7215 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7218 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
7219 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
7220 * static across every commitment transaction.
7222 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7225 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
7226 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
7227 * static across every commitment transaction.
7229 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7232 * The base point which is used (with derive_public_key) to derive a per-commitment payment
7233 * public key which receives non-HTLC-encumbered funds which are only available for spending
7234 * after some delay (or can be claimed via the revocation path).
7236 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7239 * The base point which is used (with derive_public_key) to derive a per-commitment payment
7240 * public key which receives non-HTLC-encumbered funds which are only available for spending
7241 * after some delay (or can be claimed via the revocation path).
7243 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7246 * The base point which is used (with derive_public_key) to derive a per-commitment public key
7247 * which is used to encumber HTLC-in-flight outputs.
7249 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
7252 * The base point which is used (with derive_public_key) to derive a per-commitment public key
7253 * which is used to encumber HTLC-in-flight outputs.
7255 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7257 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);
7259 LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
7261 struct LDKChannelPublicKeys ChannelPublicKeys_read(struct LDKu8slice ser);
7264 * Create per-state keys from channel base points and the per-commitment point.
7265 * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
7267 MUST_USE_RES 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);
7270 * Generate per-state keys from channel static keys.
7271 * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
7273 MUST_USE_RES 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);
7276 * A script either spendable by the revocation
7277 * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
7278 * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
7280 LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
7282 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_ptr);
7284 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
7287 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
7288 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
7289 * need to compare this value to whether the commitment transaction in question is that of
7290 * the counterparty or our own.
7292 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7295 * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
7296 * Note that this is not the same as whether it is ountbound *from us*. To determine that you
7297 * need to compare this value to whether the commitment transaction in question is that of
7298 * the counterparty or our own.
7300 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
7303 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
7304 * this divided by 1000.
7306 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7309 * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
7310 * this divided by 1000.
7312 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
7315 * The CLTV lock-time at which this HTLC expires.
7317 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
7320 * The CLTV lock-time at which this HTLC expires.
7322 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
7325 * The hash of the preimage which unlocks this HTLC.
7327 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
7330 * The hash of the preimage which unlocks this HTLC.
7332 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7334 LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
7336 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(struct LDKu8slice ser);
7339 * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
7340 * does not need to have its previous_output_index filled.
7342 LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
7345 * Gets the redeemscript for a funding output from the two funding public keys.
7346 * Note that the order of funding public keys does not matter.
7348 LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
7351 * panics if htlc.transaction_output_index.is_none()!
7353 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);
7355 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_ptr);
7357 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
7360 * Holder public keys
7362 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7365 * Holder public keys
7367 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
7370 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
7372 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7375 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
7377 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
7380 * Whether the holder is the initiator of this channel.
7381 * This is an input to the commitment number obscure factor computation.
7383 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7386 * Whether the holder is the initiator of this channel.
7387 * This is an input to the commitment number obscure factor computation.
7389 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
7392 * The late-bound counterparty channel transaction parameters.
7393 * These parameters are populated at the point in the protocol where the counterparty provides them.
7395 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7398 * The late-bound counterparty channel transaction parameters.
7399 * These parameters are populated at the point in the protocol where the counterparty provides them.
7401 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
7404 * The late-bound funding outpoint
7406 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
7409 * The late-bound funding outpoint
7411 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
7413 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);
7415 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_ptr);
7417 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
7420 * Counter-party public keys
7422 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
7425 * Counter-party public keys
7427 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
7430 * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
7432 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
7435 * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
7437 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
7439 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
7442 * Whether the late bound parameters are populated.
7444 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7447 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
7448 * given that the holder is the broadcaster.
7450 * self.is_populated() must be true before calling this function.
7452 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7455 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
7456 * given that the counterparty is the broadcaster.
7458 * self.is_populated() must be true before calling this function.
7460 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
7462 LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
7464 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
7466 LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
7468 struct LDKChannelTransactionParameters ChannelTransactionParameters_read(struct LDKu8slice ser);
7470 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_ptr);
7473 * Get the channel pubkeys for the broadcaster
7475 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7478 * Get the channel pubkeys for the countersignatory
7480 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7483 * Get the contest delay applicable to the transactions.
7484 * Note that the contest delay was selected by the countersignatory.
7486 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7489 * Whether the channel is outbound from the broadcaster.
7491 * The boolean representing the side that initiated the channel is
7492 * an input to the commitment number obscure factor computation.
7494 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7497 * The funding outpoint
7499 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
7501 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_ptr);
7503 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
7506 * Our counterparty's signature for the transaction
7508 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
7511 * Our counterparty's signature for the transaction
7513 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
7516 * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
7518 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, LDKCVec_SignatureZ val);
7520 LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
7522 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(struct LDKu8slice ser);
7525 * Create a new holder transaction with the given counterparty signatures.
7526 * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
7528 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);
7530 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_ptr);
7532 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
7535 * The commitment transaction
7537 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
7540 * The commitment transaction
7542 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
7545 * The txid for the commitment transaction.
7547 * This is provided as a performance optimization, instead of calling transaction.txid()
7550 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
7553 * The txid for the commitment transaction.
7555 * This is provided as a performance optimization, instead of calling transaction.txid()
7558 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
7560 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
7562 LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
7564 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_read(struct LDKu8slice ser);
7567 * Get the SIGHASH_ALL sighash value of the transaction.
7569 * This can be used to verify a signature.
7571 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);
7574 * Sign a transaction, either because we are counter-signing the counterparty's transaction or
7575 * because we are about to broadcast a holder transaction.
7577 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);
7579 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_ptr);
7581 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
7583 LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
7585 struct LDKCommitmentTransaction CommitmentTransaction_read(struct LDKu8slice ser);
7588 * The backwards-counting commitment number
7590 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7593 * The value to be sent to the broadcaster
7595 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7598 * The value to be sent to the counterparty
7600 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7603 * The feerate paid per 1000-weight-unit in this commitment transaction.
7605 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7608 * Trust our pre-built transaction and derived transaction creation public keys.
7610 * Applies a wrapper which allows access to these fields.
7612 * This should only be used if you fully trust the builder of this object. It should not
7613 *\tbe used by an external signer - instead use the verify function.
7615 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
7618 * Verify our pre-built transaction and derived transaction creation public keys.
7620 * Applies a wrapper which allows access to these fields.
7622 * An external validating signer must call this method before signing
7623 * or using the built transaction.
7625 MUST_USE_RES 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);
7627 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_ptr);
7630 * The transaction ID of the built Bitcoin transaction
7632 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7635 * The pre-built Bitcoin commitment transaction
7637 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7640 * The pre-calculated transaction creation public keys.
7642 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
7645 * Get a signature for each HTLC which was included in the commitment transaction (ie for
7646 * which HTLCOutputInCommitment::transaction_output_index.is_some()).
7648 * The returned Vec has one entry for each HTLC, and in the same order.
7650 MUST_USE_RES 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);
7653 * Get the transaction number obscure factor
7655 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
7657 void InitFeatures_free(struct LDKInitFeatures this_ptr);
7659 void NodeFeatures_free(struct LDKNodeFeatures this_ptr);
7661 void ChannelFeatures_free(struct LDKChannelFeatures this_ptr);
7663 void RouteHop_free(struct LDKRouteHop this_ptr);
7665 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
7668 * The node_id of the node at this hop.
7670 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7673 * The node_id of the node at this hop.
7675 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7678 * The node_announcement features of the node at this hop. For the last hop, these may be
7679 * amended to match the features present in the invoice this node generated.
7681 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7684 * The node_announcement features of the node at this hop. For the last hop, these may be
7685 * amended to match the features present in the invoice this node generated.
7687 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
7690 * The channel that should be used from the previous hop to reach this node.
7692 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7695 * The channel that should be used from the previous hop to reach this node.
7697 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
7700 * The channel_announcement features of the channel that should be used from the previous hop
7701 * to reach this node.
7703 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7706 * The channel_announcement features of the channel that should be used from the previous hop
7707 * to reach this node.
7709 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
7712 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
7714 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7717 * The fee taken on this hop. For the last hop, this should be the full value of the payment.
7719 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
7722 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
7723 * expected at the destination, in excess of the current block height.
7725 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
7728 * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
7729 * expected at the destination, in excess of the current block height.
7731 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
7733 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);
7735 void Route_free(struct LDKRoute this_ptr);
7737 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
7740 * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
7741 * last RouteHop in each path must be the same.
7742 * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
7743 * destination. Thus, this must always be at least length one. While the maximum length of any
7744 * given path is variable, keeping the length of any path to less than 20 should currently
7745 * ensure it is viable.
7747 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, LDKCVec_CVec_RouteHopZZ val);
7749 MUST_USE_RES struct LDKRoute Route_new(LDKCVec_CVec_RouteHopZZ paths_arg);
7751 LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
7753 LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
7755 void RouteHint_free(struct LDKRouteHint this_ptr);
7757 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
7760 * The node_id of the non-target end of the route
7762 struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7765 * The node_id of the non-target end of the route
7767 void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7770 * The short_channel_id of this channel
7772 uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7775 * The short_channel_id of this channel
7777 void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
7780 * The fees which must be paid to use this channel
7782 struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7785 * The fees which must be paid to use this channel
7787 void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
7790 * The difference in CLTV values between this node and the next node.
7792 uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7795 * The difference in CLTV values between this node and the next node.
7797 void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val);
7800 * The minimum value, in msat, which must be relayed to the next hop.
7802 uint64_t RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
7805 * The minimum value, in msat, which must be relayed to the next hop.
7807 void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
7809 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);
7812 * Gets a route from us to the given target node.
7814 * Extra routing hops between known nodes and the target will be used if they are included in
7817 * If some channels aren't announced, it may be useful to fill in a first_hops with the
7818 * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
7819 * view of our local channels (from net_graph_msg_handler) will be ignored, and only those in first_hops
7822 * Panics if first_hops contains channels without short_channel_ids
7823 * (ChannelManager::list_usable_channels will never include such channels).
7825 * The fees on channels from us to next-hops are ignored (as they are assumed to all be
7826 * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat
7827 * *is* checked as they may change based on the receiving node.
7829 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);
7831 void NetworkGraph_free(struct LDKNetworkGraph this_ptr);
7833 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr);
7835 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr);
7838 * Creates a new tracker of the actual state of the network of channels and nodes,
7839 * assuming a fresh network graph.
7840 * Chain monitor is used to make sure announced channels exist on-chain,
7841 * channel data is correct, and that the announcement is signed with
7842 * channel owners' keys.
7844 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
7847 * Creates a new tracker of the actual state of the network of channels and nodes,
7848 * assuming an existing Network Graph.
7850 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
7853 * Take a read lock on the network_graph and return it in the C-bindings
7854 * newtype helper. This is likely only useful when called via the C
7855 * bindings as you can call `self.network_graph.read().unwrap()` in Rust
7858 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7861 * Get a reference to the NetworkGraph which this read-lock contains.
7863 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
7865 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7867 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
7869 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_ptr);
7872 * When the last update to the channel direction was issued.
7873 * Value is opaque, as set in the announcement.
7875 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7878 * When the last update to the channel direction was issued.
7879 * Value is opaque, as set in the announcement.
7881 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
7884 * Whether the channel can be currently used for payments (in this one direction).
7886 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7889 * Whether the channel can be currently used for payments (in this one direction).
7891 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
7894 * The difference in CLTV values that you must have when routing through this channel.
7896 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7899 * The difference in CLTV values that you must have when routing through this channel.
7901 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
7904 * The minimum value, which must be relayed to the next hop via the channel
7906 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7909 * The minimum value, which must be relayed to the next hop via the channel
7911 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
7914 * Fees charged when the channel is used for routing
7916 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7919 * Fees charged when the channel is used for routing
7921 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
7924 * Most recent update for the channel received from the network
7925 * Mostly redundant with the data we store in fields explicitly.
7926 * Everything else is useful only for sending out for initial routing sync.
7927 * Not stored if contains excess data to prevent DoS.
7929 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
7932 * Most recent update for the channel received from the network
7933 * Mostly redundant with the data we store in fields explicitly.
7934 * Everything else is useful only for sending out for initial routing sync.
7935 * Not stored if contains excess data to prevent DoS.
7937 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
7939 LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
7941 struct LDKDirectionalChannelInfo DirectionalChannelInfo_read(struct LDKu8slice ser);
7943 void ChannelInfo_free(struct LDKChannelInfo this_ptr);
7946 * Protocol features of a channel communicated during its announcement
7948 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7951 * Protocol features of a channel communicated during its announcement
7953 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
7956 * Source node of the first direction of a channel
7958 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7961 * Source node of the first direction of a channel
7963 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7966 * Details about the first direction of a channel
7968 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7971 * Details about the first direction of a channel
7973 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
7976 * Source node of the second direction of a channel
7978 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7981 * Source node of the second direction of a channel
7983 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
7986 * Details about the second direction of a channel
7988 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
7991 * Details about the second direction of a channel
7993 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
7996 * An initial announcement of the channel
7997 * Mostly redundant with the data we store in fields explicitly.
7998 * Everything else is useful only for sending out for initial routing sync.
7999 * Not stored if contains excess data to prevent DoS.
8001 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
8004 * An initial announcement of the channel
8005 * Mostly redundant with the data we store in fields explicitly.
8006 * Everything else is useful only for sending out for initial routing sync.
8007 * Not stored if contains excess data to prevent DoS.
8009 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
8011 LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
8013 struct LDKChannelInfo ChannelInfo_read(struct LDKu8slice ser);
8015 void RoutingFees_free(struct LDKRoutingFees this_ptr);
8017 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
8020 * Flat routing fee in satoshis
8022 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
8025 * Flat routing fee in satoshis
8027 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
8030 * Liquidity-based routing fee in millionths of a routed amount.
8031 * In other words, 10000 is 1%.
8033 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
8036 * Liquidity-based routing fee in millionths of a routed amount.
8037 * In other words, 10000 is 1%.
8039 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
8041 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
8043 LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
8045 LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
8047 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_ptr);
8050 * Protocol features the node announced support for
8052 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
8055 * Protocol features the node announced support for
8057 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
8060 * When the last known update to the node state was issued.
8061 * Value is opaque, as set in the announcement.
8063 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
8066 * When the last known update to the node state was issued.
8067 * Value is opaque, as set in the announcement.
8069 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
8072 * Color assigned to the node
8074 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
8077 * Color assigned to the node
8079 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
8082 * Moniker assigned to the node.
8083 * May be invalid or malicious (eg control chars),
8084 * should not be exposed to the user.
8086 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
8089 * Moniker assigned to the node.
8090 * May be invalid or malicious (eg control chars),
8091 * should not be exposed to the user.
8093 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
8096 * Internet-level addresses via which one can connect to the node
8098 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, LDKCVec_NetAddressZ val);
8101 * An initial announcement of the node
8102 * Mostly redundant with the data we store in fields explicitly.
8103 * Everything else is useful only for sending out for initial routing sync.
8104 * Not stored if contains excess data to prevent DoS.
8106 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
8109 * An initial announcement of the node
8110 * Mostly redundant with the data we store in fields explicitly.
8111 * Everything else is useful only for sending out for initial routing sync.
8112 * Not stored if contains excess data to prevent DoS.
8114 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
8116 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);
8118 LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
8120 LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
8122 void NodeInfo_free(struct LDKNodeInfo this_ptr);
8125 * All valid channels a node has announced
8127 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, LDKCVec_u64Z val);
8130 * Lowest fees enabling routing via any of the enabled, known channels to a node.
8131 * The two fields (flat and proportional fee) are independent,
8132 * meaning they don't have to refer to the same channel.
8134 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
8137 * Lowest fees enabling routing via any of the enabled, known channels to a node.
8138 * The two fields (flat and proportional fee) are independent,
8139 * meaning they don't have to refer to the same channel.
8141 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
8144 * More information about a node from node_announcement.
8145 * Optional because we store a Node entry after learning about it from
8146 * a channel announcement, but before receiving a node announcement.
8148 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
8151 * More information about a node from node_announcement.
8152 * Optional because we store a Node entry after learning about it from
8153 * a channel announcement, but before receiving a node announcement.
8155 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
8157 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
8159 LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
8161 LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
8163 LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
8165 LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
8168 * Creates a new, empty, network graph.
8170 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
8173 * For an already known node (from channel announcements), update its stored properties from a
8174 * given node announcement.
8176 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8177 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8178 * routing messages from a source using a protocol other than the lightning P2P protocol.
8180 MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8183 * For an already known node (from channel announcements), update its stored properties from a
8184 * given node announcement without verifying the associated signatures. Because we aren't
8185 * given the associated signatures here we cannot relay the node announcement to any of our
8188 MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
8191 * Store or update channel info from a channel announcement.
8193 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8194 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8195 * routing messages from a source using a protocol other than the lightning P2P protocol.
8197 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
8198 * the corresponding UTXO exists on chain and is correctly-formatted.
8200 MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
8203 * Store or update channel info from a channel announcement without verifying the associated
8204 * signatures. Because we aren't given the associated signatures here we cannot relay the
8205 * channel announcement to any of our peers.
8207 * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
8208 * the corresponding UTXO exists on chain and is correctly-formatted.
8210 MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
8213 * Close a channel if a corresponding HTLC fail was sent.
8214 * If permanent, removes a channel from the local storage.
8215 * May cause the removal of nodes too, if this was their last channel.
8216 * If not permanent, makes channels unavailable for routing.
8218 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
8221 * For an already known (from announcement) channel, update info about one of the directions
8224 * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
8225 * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
8226 * routing messages from a source using a protocol other than the lightning P2P protocol.
8228 MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8231 * For an already known (from announcement) channel, update info about one of the directions
8232 * of the channel without verifying the associated signatures. Because we aren't given the
8233 * associated signatures here we cannot relay the channel update to any of our peers.
8235 MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
8237 /* Text to put at the end of the generated file */