+/**
+ * The contents of CResult_NetAddressDecodeErrorZ
+ */
+typedef union LDKCResult_NetAddressDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKNetAddress *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_NetAddressDecodeErrorZPtr;
+
+/**
+ * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NetAddressDecodeErrorZ {
+ /**
+ * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NetAddressDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NetAddressDecodeErrorZ;
+
+
+
+/**
+ * An update_add_htlc message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeUpdateAddHTLC *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKUpdateAddHTLC;
+
+/**
+ * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_UpdateAddHTLCZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKUpdateAddHTLC *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_UpdateAddHTLCZ;
+
+
+
+/**
+ * An update_fulfill_htlc message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeUpdateFulfillHTLC *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKUpdateFulfillHTLC;
+
+/**
+ * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_UpdateFulfillHTLCZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKUpdateFulfillHTLC *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_UpdateFulfillHTLCZ;
+
+
+
+/**
+ * An update_fail_htlc message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeUpdateFailHTLC *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKUpdateFailHTLC;
+
+/**
+ * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_UpdateFailHTLCZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKUpdateFailHTLC *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_UpdateFailHTLCZ;
+
+
+
+/**
+ * An update_fail_malformed_htlc message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeUpdateFailMalformedHTLC *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKUpdateFailMalformedHTLC;
+
+/**
+ * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKUpdateFailMalformedHTLC *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_UpdateFailMalformedHTLCZ;
+
+/**
+ * The contents of CResult_AcceptChannelDecodeErrorZ
+ */
+typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKAcceptChannel *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_AcceptChannelDecodeErrorZPtr;
+
+/**
+ * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
+ /**
+ * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_AcceptChannelDecodeErrorZ;
+
+/**
+ * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
+ */
+typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKAnnouncementSignatures *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
+
+/**
+ * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
+ /**
+ * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_AnnouncementSignaturesDecodeErrorZ;
+
+/**
+ * The contents of CResult_ChannelReestablishDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelReestablish *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelReestablishDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelReestablishDecodeErrorZ;
+
+/**
+ * The contents of CResult_ClosingSignedDecodeErrorZ
+ */
+typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKClosingSigned *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_ClosingSignedDecodeErrorZPtr;
+
+/**
+ * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
+ /**
+ * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ClosingSignedDecodeErrorZ;
+
+
+
+/**
+ * A commitment_signed message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeCommitmentSigned *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKCommitmentSigned;
+
+/**
+ * The contents of CResult_CommitmentSignedDecodeErrorZ
+ */
+typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKCommitmentSigned *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_CommitmentSignedDecodeErrorZPtr;
+
+/**
+ * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
+ /**
+ * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_CommitmentSignedDecodeErrorZ;
+
+/**
+ * The contents of CResult_FundingCreatedDecodeErrorZ
+ */
+typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKFundingCreated *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_FundingCreatedDecodeErrorZPtr;
+
+/**
+ * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
+ /**
+ * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_FundingCreatedDecodeErrorZ;
+
+/**
+ * The contents of CResult_FundingSignedDecodeErrorZ
+ */
+typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKFundingSigned *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_FundingSignedDecodeErrorZPtr;
+
+/**
+ * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_FundingSignedDecodeErrorZ {
+ /**
+ * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_FundingSignedDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_FundingSignedDecodeErrorZ;
+
+/**
+ * The contents of CResult_FundingLockedDecodeErrorZ
+ */
+typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKFundingLocked *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_FundingLockedDecodeErrorZPtr;
+
+/**
+ * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_FundingLockedDecodeErrorZ {
+ /**
+ * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_FundingLockedDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_FundingLockedDecodeErrorZ;
+
+
+
+/**
+ * An init message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKInit {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeInit *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKInit;
+
+/**
+ * The contents of CResult_InitDecodeErrorZ
+ */
+typedef union LDKCResult_InitDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKInit *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_InitDecodeErrorZPtr;
+
+/**
+ * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_InitDecodeErrorZ {
+ /**
+ * The contents of this CResult_InitDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_InitDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_InitDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_InitDecodeErrorZ;
+
+/**
+ * The contents of CResult_OpenChannelDecodeErrorZ
+ */
+typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKOpenChannel *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_OpenChannelDecodeErrorZPtr;
+
+/**
+ * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_OpenChannelDecodeErrorZ {
+ /**
+ * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_OpenChannelDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_OpenChannelDecodeErrorZ;
+
+/**
+ * The contents of CResult_RevokeAndACKDecodeErrorZ
+ */
+typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKRevokeAndACK *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_RevokeAndACKDecodeErrorZPtr;
+
+/**
+ * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
+ /**
+ * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_RevokeAndACKDecodeErrorZ;
+
+/**
+ * The contents of CResult_ShutdownDecodeErrorZ
+ */
+typedef union LDKCResult_ShutdownDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKShutdown *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_ShutdownDecodeErrorZPtr;
+
+/**
+ * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_ShutdownDecodeErrorZ {
+ /**
+ * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ShutdownDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ShutdownDecodeErrorZ;
+
+/**
+ * The contents of CResult_UpdateFailHTLCDecodeErrorZ
+ */
+typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUpdateFailHTLC *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
+
+/**
+ * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
+ /**
+ * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UpdateFailHTLCDecodeErrorZ;
+
+/**
+ * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
+ */
+typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUpdateFailMalformedHTLC *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
+
+/**
+ * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
+ /**
+ * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
+
+
+
+/**
+ * An update_fee message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKUpdateFee {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeUpdateFee *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKUpdateFee;
+
+/**
+ * The contents of CResult_UpdateFeeDecodeErrorZ
+ */
+typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUpdateFee *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_UpdateFeeDecodeErrorZPtr;
+
+/**
+ * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
+ /**
+ * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UpdateFeeDecodeErrorZ;
+
+/**
+ * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
+ */
+typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUpdateFulfillHTLC *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
+
+/**
+ * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
+ /**
+ * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
+
+/**
+ * The contents of CResult_UpdateAddHTLCDecodeErrorZ
+ */
+typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUpdateAddHTLC *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
+
+/**
+ * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
+ /**
+ * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UpdateAddHTLCDecodeErrorZ;
+
+
+
+/**
+ * A ping message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKPing {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativePing *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKPing;
+
+/**
+ * The contents of CResult_PingDecodeErrorZ
+ */
+typedef union LDKCResult_PingDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKPing *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_PingDecodeErrorZPtr;
+
+/**
+ * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PingDecodeErrorZ {
+ /**
+ * The contents of this CResult_PingDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PingDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_PingDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PingDecodeErrorZ;
+
+
+
+/**
+ * A pong message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKPong {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativePong *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKPong;
+
+/**
+ * The contents of CResult_PongDecodeErrorZ
+ */
+typedef union LDKCResult_PongDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKPong *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_PongDecodeErrorZPtr;
+
+/**
+ * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PongDecodeErrorZ {
+ /**
+ * The contents of this CResult_PongDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PongDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_PongDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PongDecodeErrorZ;
+
+/**
+ * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
+ */
+typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUnsignedChannelAnnouncement *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
+
+/**
+ * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
+ /**
+ * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
+
+/**
+ * The contents of CResult_ChannelAnnouncementDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelAnnouncement *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelAnnouncementDecodeErrorZ;
+
+
+
+/**
+ * The unsigned part of a channel_update
+ */
+typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeUnsignedChannelUpdate *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKUnsignedChannelUpdate;
+
+/**
+ * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
+ */
+typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUnsignedChannelUpdate *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
+
+/**
+ * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
+ /**
+ * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
+
+/**
+ * The contents of CResult_ChannelUpdateDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelUpdate *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelUpdateDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelUpdateDecodeErrorZ;
+
+/**
+ * The contents of CResult_ErrorMessageDecodeErrorZ
+ */
+typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKErrorMessage *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_ErrorMessageDecodeErrorZPtr;
+
+/**
+ * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
+ /**
+ * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ErrorMessageDecodeErrorZ;
+
+
+
+/**
+ * The unsigned part of a node_announcement
+ */
+typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeUnsignedNodeAnnouncement *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKUnsignedNodeAnnouncement;
+
+/**
+ * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
+ */
+typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUnsignedNodeAnnouncement *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
+
+/**
+ * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
+ /**
+ * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
+
+/**
+ * The contents of CResult_NodeAnnouncementDecodeErrorZ
+ */
+typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKNodeAnnouncement *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_NodeAnnouncementDecodeErrorZPtr;
+
+/**
+ * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
+ /**
+ * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NodeAnnouncementDecodeErrorZ;
+
+/**
+ * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
+ */
+typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKQueryShortChannelIds *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
+
+/**
+ * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
+ /**
+ * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_QueryShortChannelIdsDecodeErrorZ;
+
+
+
+/**
+ * A reply_short_channel_ids_end message is sent as a reply to a
+ * query_short_channel_ids message. The query recipient makes a best
+ * effort to respond based on their local network view which may not be
+ * a perfect view of the network.
+ */
+typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeReplyShortChannelIdsEnd *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKReplyShortChannelIdsEnd;
+
+/**
+ * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
+ */
+typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKReplyShortChannelIdsEnd *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
+
+/**
+ * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
+ /**
+ * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
+
+/**
+ * The contents of CResult_QueryChannelRangeDecodeErrorZ
+ */
+typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKQueryChannelRange *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_QueryChannelRangeDecodeErrorZPtr;
+
+/**
+ * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
+ /**
+ * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_QueryChannelRangeDecodeErrorZ;
+
+/**
+ * The contents of CResult_ReplyChannelRangeDecodeErrorZ
+ */
+typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKReplyChannelRange *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
+
+/**
+ * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
+ /**
+ * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ReplyChannelRangeDecodeErrorZ;
+
+
+
+/**
+ * A gossip_timestamp_filter message is used by a node to request
+ * gossip relay for messages in the requested time range when the
+ * gossip_queries feature has been negotiated.
+ */
+typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeGossipTimestampFilter *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKGossipTimestampFilter;
+
+/**
+ * The contents of CResult_GossipTimestampFilterDecodeErrorZ
+ */
+typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKGossipTimestampFilter *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
+
+/**
+ * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
+ /**
+ * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_GossipTimestampFilterDecodeErrorZ;
+
+/**
+ * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
+ * may occur.
+ */
+typedef enum LDKSignOrCreationError_Tag {
+ /**
+ * An error occurred during signing
+ */
+ LDKSignOrCreationError_SignError,
+ /**
+ * An error occurred while building the transaction
+ */
+ LDKSignOrCreationError_CreationError,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKSignOrCreationError_Sentinel,
+} LDKSignOrCreationError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
+ LDKSignOrCreationError_Tag tag;
+ union {
+ struct {
+ enum LDKCreationError creation_error;
+ };
+ };
+} LDKSignOrCreationError;
+
+/**
+ * The contents of CResult_InvoiceSignOrCreationErrorZ
+ */
+typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKInvoice *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKSignOrCreationError *err;
+} LDKCResult_InvoiceSignOrCreationErrorZPtr;
+
+/**
+ * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
+ /**
+ * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
+ /**
+ * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_InvoiceSignOrCreationErrorZ;
+
+/**
+ * A trait indicating an object may generate message send events
+ */
+typedef struct LDKMessageSendEventsProvider {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Gets the list of pending events which were generated by previous actions, clearing the list
+ * in the process.
+ */
+ struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKMessageSendEventsProvider;
+
+/**
+ * A trait implemented for objects handling events from [`EventsProvider`].
+ */
+typedef struct LDKEventHandler {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Handles the given [`Event`].
+ *
+ * See [`EventsProvider`] for details that must be considered when implementing this method.
+ */
+ void (*handle_event)(const void *this_arg, struct LDKEvent event);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKEventHandler;
+
+/**
+ * A trait indicating an object may generate events.
+ *
+ * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
+ *
+ * # Requirements
+ *
+ * See [`process_pending_events`] for requirements around event processing.
+ *
+ * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
+ * event since the last invocation. The handler must either act upon the event immediately
+ * or preserve it for later handling.
+ *
+ * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
+ * consult the provider's documentation on the implication of processing events and how a handler
+ * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
+ * [`ChainMonitor::process_pending_events`]).
+ *
+ * (C-not implementable) As there is likely no reason for a user to implement this trait on their
+ * own type(s).
+ *
+ * [`process_pending_events`]: Self::process_pending_events
+ * [`handle_event`]: EventHandler::handle_event
+ * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
+ * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
+ */
+typedef struct LDKEventsProvider {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Processes any events generated since the last call using the given event handler.
+ *
+ * Subsequent calls must only process new events. However, handlers must be capable of handling
+ * duplicate events across process restarts. This may occur if the provider was recovered from
+ * an old state (i.e., it hadn't been successfully persisted after processing pending events).
+ */
+ void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKEventsProvider;
+
+
+
+/**
+ * Configuration we set when applicable.
+ *
+ * Default::default() provides sane defaults.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeChannelHandshakeConfig *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKChannelHandshakeConfig;
+
+
+
+/**
+ * Optional channel limits which are applied during channel creation.
+ *
+ * These limits are only applied to our counterparty's limits, not our own.
+ *
+ * Use 0/<type>::max_value() as appropriate to skip checking.
+ *
+ * Provides sane defaults for most configurations.
+ *
+ * Most additional limits are disabled except those with which specify a default in individual
+ * field documentation. Note that this may result in barely-usable channels, but since they
+ * are applied mostly only to incoming channels that's not much of a problem.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeChannelHandshakeLimits *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKChannelHandshakeLimits;
+
+
+
+/**
+ * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
+ *
+ * Default::default() provides sane defaults for most configurations
+ * (but currently with 0 relay fees!)
+ */
+typedef struct MUST_USE_STRUCT LDKUserConfig {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeUserConfig *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKUserConfig;
+
+
+
+/**
+ * The best known block as identified by its hash and height.
+ */
+typedef struct MUST_USE_STRUCT LDKBestBlock {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeBestBlock *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKBestBlock;
+
+/**
+ * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
+ * UTXOs.
+ */
+typedef struct LDKAccess {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
+ * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
+ * is unknown.
+ *
+ * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
+ */
+ struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKAccess;
+
+/**
+ * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
+ * chain.
+ *
+ * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
+ * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
+ * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
+ * when needed.
+ */
+typedef struct LDKListen {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Notifies the listener that a block was added at the given height.
+ */
+ void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
+ /**
+ * Notifies the listener that a block was removed at the given height.
+ */
+ void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKListen;
+
+/**
+ * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
+ * unconfirmed during a chain reorganization.
+ *
+ * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
+ * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
+ * related to registered transactions and outputs. Upon notification, it would pass along the
+ * matching transactions using this interface.
+ *
+ * # Use
+ *
+ * The intended use is as follows:
+ * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
+ * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
+ * that has been reorganized out of the chain.
+ * - Call [`best_block_updated`] whenever a new chain tip becomes available.
+ *
+ * # Order
+ *
+ * Clients must call these methods in chain order. Specifically:
+ * - Transactions confirmed in a block must be given before transactions confirmed in a later
+ * block.
+ * - Dependent transactions within the same block must be given in topological order, possibly in
+ * separate calls.
+ * - Unconfirmed transactions must be given after the original confirmations and before any
+ * reconfirmation.
+ *
+ * See individual method documentation for further details.
+ *
+ * [`transactions_confirmed`]: Self::transactions_confirmed
+ * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
+ * [`best_block_updated`]: Self::best_block_updated
+ * [`get_relevant_txids`]: Self::get_relevant_txids
+ */
+typedef struct LDKConfirm {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Processes transactions confirmed in a block with a given header and height.
+ *
+ * Should be called for any transactions registered by [`Filter::register_tx`] or any
+ * transactions spending an output registered by [`Filter::register_output`]. Such transactions
+ * appearing in the same block do not need to be included in the same call; instead, multiple
+ * calls with additional transactions may be made so long as they are made in [chain order].
+ *
+ * May be called before or after [`best_block_updated`] for the corresponding block. However,
+ * in the event of a chain reorganization, it must not be called with a `header` that is no
+ * longer in the chain as of the last call to [`best_block_updated`].
+ *
+ * [chain order]: Confirm#Order
+ * [`best_block_updated`]: Self::best_block_updated
+ */
+ void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
+ /**
+ * Processes a transaction that is no longer confirmed as result of a chain reorganization.
+ *
+ * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
+ * reorganized out of the best chain. Once called, the given transaction should not be returned
+ * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
+ *
+ * [`get_relevant_txids`]: Self::get_relevant_txids
+ * [`transactions_confirmed`]: Self::transactions_confirmed
+ */
+ void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
+ /**
+ * Processes an update to the best header connected at the given height.
+ *
+ * Should be called when a new header is available but may be skipped for intermediary blocks
+ * if they become available at the same time.
+ */
+ void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
+ /**
+ * Returns transactions that should be monitored for reorganization out of the chain.
+ *
+ * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
+ * confirmations to be safe from a chain reorganization. Should not include any transactions
+ * passed to [`transaction_unconfirmed`] unless later reconfirmed.
+ *
+ * May be called to determine the subset of transactions that must still be monitored for
+ * reorganization. Will be idempotent between calls but may change as a result of calls to the
+ * other interface methods. Thus, this is useful to determine which transactions may need to be
+ * given to [`transaction_unconfirmed`].
+ *
+ * [`transactions_confirmed`]: Self::transactions_confirmed
+ * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
+ */
+ struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKConfirm;
+
+
+
+/**
+ * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
+ *
+ * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
+ * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
+ * the return value of [`Filter::register_output`].
+ *
+ * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
+ * may have been spent there. See [`Filter::register_output`] for details.
+ *
+ * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
+ * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
+ */
+typedef struct MUST_USE_STRUCT LDKWatchedOutput {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeWatchedOutput *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKWatchedOutput;
+
+/**
+ * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
+ * channels.
+ *
+ * This is useful in order to have a [`Watch`] implementation convey to a chain source which
+ * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
+ * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
+ * receiving full blocks from a chain source, any further filtering is unnecessary.
+ *
+ * After an output has been registered, subsequent block retrievals from the chain source must not
+ * exclude any transactions matching the new criteria nor any in-block descendants of such
+ * transactions.
+ *
+ * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
+ * should not block on I/O. Implementations should instead queue the newly monitored data to be
+ * processed later. Then, in order to block until the data has been processed, any [`Watch`]
+ * invocation that has called the `Filter` must return [`TemporaryFailure`].
+ *
+ * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
+ * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
+ * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
+ */
+typedef struct LDKFilter {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
+ * a spending condition.
+ */
+ void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
+ /**
+ * Registers interest in spends of a transaction output.
+ *
+ * Optionally, when `output.block_hash` is set, should return any transaction spending the
+ * output that is found in the corresponding block along with its index.
+ *
+ * This return value is useful for Electrum clients in order to supply in-block descendant
+ * transactions which otherwise were not included. This is not necessary for other clients if
+ * such descendant transactions were already included (e.g., when a BIP 157 client provides the
+ * full block).
+ */
+ struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKFilter;
+
+/**
+ * `Persist` defines behavior for persisting channel monitors: this could mean
+ * writing once to disk, and/or uploading to one or more backup services.
+ *
+ * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
+ * to disk/backups. And, on every update, you **must** persist either the
+ * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
+ * of situations such as revoking a transaction, then crashing before this
+ * revocation can be persisted, then unintentionally broadcasting a revoked
+ * transaction and losing money. This is a risk because previous channel states
+ * are toxic, so it's important that whatever channel state is persisted is
+ * kept up-to-date.
+ */
+typedef struct LDKPersist {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Persist a new channel's data. The data can be stored any way you want, but
+ * the identifier provided by Rust-Lightning is the channel's outpoint (and
+ * it is up to you to maintain a correct mapping between the outpoint and the
+ * stored channel data). Note that you **must** persist every new monitor to
+ * disk. See the `Persist` trait documentation for more details.
+ *
+ * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
+ * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+ */
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
+ /**
+ * Update one channel's data. The provided `ChannelMonitor` has already
+ * applied the given update.
+ *
+ * Note that on every update, you **must** persist either the
+ * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
+ * the `Persist` trait documentation for more details.
+ *
+ * If an implementer chooses to persist the updates only, they need to make
+ * sure that all the updates are applied to the `ChannelMonitors` *before*
+ * the set of channel monitors is given to the `ChannelManager`
+ * deserialization routine. See [`ChannelMonitor::update_monitor`] for
+ * applying a monitor update to a monitor. If full `ChannelMonitors` are
+ * persisted, then there is no need to persist individual updates.
+ *
+ * Note that there could be a performance tradeoff between persisting complete
+ * channel monitors on every update vs. persisting only updates and applying
+ * them in batches. The size of each monitor grows `O(number of state updates)`
+ * whereas updates are small and `O(1)`.
+ *
+ * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
+ * [`ChannelMonitorUpdate::write`] for writing out an update, and
+ * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+ */
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKPersist;
+
+
+
+/**
+ * An implementation of [`chain::Watch`] for monitoring channels.
+ *
+ * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
+ * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
+ * or used independently to monitor channels remotely. See the [module-level documentation] for
+ * details.
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [module-level documentation]: crate::chain::chainmonitor
+ */
+typedef struct MUST_USE_STRUCT LDKChainMonitor {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeChainMonitor *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKChainMonitor;
+
+
+
+/**
+ * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
+ * and derives keys from that.
+ *
+ * Your node_id is seed/0'
+ * ChannelMonitor closes may use seed/1'
+ * Cooperative closes may use seed/2'
+ * The two close keys may be needed to claim on-chain funds!
+ */
+typedef struct MUST_USE_STRUCT LDKKeysManager {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeKeysManager *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKKeysManager;
+
+
+
+/**
+ * Chain-related parameters used to construct a new `ChannelManager`.
+ *
+ * Typically, the block-specific parameters are derived from the best block hash for the network,
+ * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
+ * are not needed when deserializing a previously constructed `ChannelManager`.
+ */
+typedef struct MUST_USE_STRUCT LDKChainParameters {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeChainParameters *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKChainParameters;
+
+
+
+/**
+ * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
+ * to better separate parameters.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeChannelCounterparty *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKChannelCounterparty;
+
+/**
+ * A 3-byte byte array.
+ */
+typedef struct LDKThreeBytes {
+ /**
+ * The three bytes
+ */
+ uint8_t data[3];
+} LDKThreeBytes;
+
+/**
+ * A trait to describe an object which can receive channel messages.
+ *
+ * Messages MAY be called in parallel when they originate from different their_node_ids, however
+ * they MUST NOT be called in parallel when the two calls have the same their_node_id.
+ */
+typedef struct LDKChannelMessageHandler {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Handle an incoming open_channel message from the given peer.
+ */
+ void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
+ /**
+ * Handle an incoming accept_channel message from the given peer.
+ */
+ void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
+ /**
+ * Handle an incoming funding_created message from the given peer.
+ */
+ void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
+ /**
+ * Handle an incoming funding_signed message from the given peer.
+ */
+ void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
+ /**
+ * Handle an incoming funding_locked message from the given peer.
+ */
+ void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
+ /**
+ * Handle an incoming shutdown message from the given peer.
+ */
+ void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg);
+ /**
+ * Handle an incoming closing_signed message from the given peer.
+ */
+ void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
+ /**
+ * Handle an incoming update_add_htlc message from the given peer.
+ */
+ void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
+ /**
+ * Handle an incoming update_fulfill_htlc message from the given peer.
+ */
+ void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
+ /**
+ * Handle an incoming update_fail_htlc message from the given peer.
+ */
+ void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
+ /**
+ * Handle an incoming update_fail_malformed_htlc message from the given peer.
+ */
+ void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
+ /**
+ * Handle an incoming commitment_signed message from the given peer.
+ */
+ void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
+ /**
+ * Handle an incoming revoke_and_ack message from the given peer.
+ */
+ void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
+ /**
+ * Handle an incoming update_fee message from the given peer.
+ */
+ void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
+ /**
+ * Handle an incoming announcement_signatures message from the given peer.
+ */
+ void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
+ /**
+ * Indicates a connection to the peer failed/an existing connection was lost. If no connection
+ * is believed to be possible in the future (eg they're sending us messages we don't
+ * understand or indicate they require unknown feature bits), no_connection_possible is set
+ * and any outstanding channels should be failed.
+ */
+ void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
+ /**
+ * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
+ */
+ void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
+ /**
+ * Handle an incoming channel_reestablish message from the given peer.
+ */
+ void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
+ /**
+ * Handle an incoming channel update from the given peer.
+ */
+ void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
+ /**
+ * Handle an incoming error message from the given peer.
+ */
+ void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
+ /**
+ * Implementation of MessageSendEventsProvider for this object.
+ */
+ struct LDKMessageSendEventsProvider MessageSendEventsProvider;
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKChannelMessageHandler;
+
+
+
+/**
+ * Arguments for the creation of a ChannelManager that are not deserialized.
+ *
+ * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
+ * is:
+ * 1) Deserialize all stored ChannelMonitors.
+ * 2) Deserialize the ChannelManager by filling in this struct and calling:
+ * <(BlockHash, ChannelManager)>::read(reader, args)
+ * This may result in closing some Channels if the ChannelMonitor is newer than the stored
+ * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
+ * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
+ * way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
+ * ChannelMonitor::get_funding_txo().
+ * 4) Reconnect blocks on your ChannelMonitors.
+ * 5) Disconnect/connect blocks on the ChannelManager.
+ * 6) Move the ChannelMonitors into your local chain::Watch.
+ *
+ * Note that the ordering of #4-6 is not of importance, however all three must occur before you
+ * call any other methods on the newly-deserialized ChannelManager.
+ *
+ * Note that because some channels may be closed during deserialization, it is critical that you
+ * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
+ * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
+ * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
+ * not force-close the same channels but consider them live), you may end up revoking a state for
+ * which you've already broadcasted the transaction.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeChannelManagerReadArgs *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKChannelManagerReadArgs;
+
+
+
+/**
+ * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
+ * This is used to convince the recipient that the channel is at a certain commitment
+ * number even if they lost that data due to a local failure. Of course, the peer may lie
+ * and even later commitments may have been revoked.
+ */
+typedef struct MUST_USE_STRUCT LDKDataLossProtect {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeDataLossProtect *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKDataLossProtect;
+
+/**
+ * A trait to describe an object which can receive routing messages.
+ *
+ * # Implementor DoS Warnings
+ *
+ * For `gossip_queries` messages there are potential DoS vectors when handling
+ * inbound queries. Implementors using an on-disk network graph should be aware of
+ * repeated disk I/O for queries accessing different parts of the network graph.
+ */
+typedef struct LDKRoutingMessageHandler {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Handle an incoming node_announcement message, returning true if it should be forwarded on,
+ * false or returning an Err otherwise.
+ */
+ struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
+ /**
+ * Handle a channel_announcement message, returning true if it should be forwarded on, false
+ * or returning an Err otherwise.
+ */
+ struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
+ /**
+ * Handle an incoming channel_update message, returning true if it should be forwarded on,
+ * false or returning an Err otherwise.
+ */
+ struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
+ /**
+ * Handle some updates to the route graph that we learned due to an outbound failed payment.
+ */
+ void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
+ /**
+ * Gets a subset of the channel announcements and updates required to dump our routing table
+ * to a remote node, starting at the short_channel_id indicated by starting_point and
+ * including the batch_amount entries immediately higher in numerical value than starting_point.
+ */
+ struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
+ /**
+ * Gets a subset of the node announcements required to dump our routing table to a remote node,
+ * starting at the node *after* the provided publickey and including batch_amount entries
+ * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
+ * If None is provided for starting_point, we start at the first node.
+ *
+ * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
+ /**
+ * Called when a connection is established with a peer. This can be used to
+ * perform routing table synchronization using a strategy defined by the
+ * implementor.
+ */
+ void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
+ /**
+ * Handles the reply of a query we initiated to learn about channels
+ * for a given range of blocks. We can expect to receive one or more
+ * replies to a single query.
+ */
+ struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
+ /**
+ * Handles the reply of a query we initiated asking for routing gossip
+ * messages for a list of channels. We should receive this message when
+ * a node has completed its best effort to send us the pertaining routing
+ * gossip messages.
+ */
+ struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
+ /**
+ * Handles when a peer asks us to send a list of short_channel_ids
+ * for the requested range of blocks.
+ */
+ struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
+ /**
+ * Handles when a peer asks us to send routing gossip messages for a
+ * list of short_channel_ids.
+ */
+ struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
+ /**
+ * Implementation of MessageSendEventsProvider for this object.
+ */
+ struct LDKMessageSendEventsProvider MessageSendEventsProvider;
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKRoutingMessageHandler;
+
+
+
+/**
+ * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
+ * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
+ */
+typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeIgnoringMessageHandler *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKIgnoringMessageHandler;
+
+
+
+/**
+ * A dummy struct which implements `ChannelMessageHandler` without having any channels.
+ * You can provide one of these as the route_handler in a MessageHandler.
+ */
+typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeErroringMessageHandler *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKErroringMessageHandler;
+
+
+
+/**
+ * Provides references to trait impls which handle different types of messages.
+ */
+typedef struct MUST_USE_STRUCT LDKMessageHandler {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeMessageHandler *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKMessageHandler;
+
+/**
+ * Provides an object which can be used to send data to and which uniquely identifies a connection
+ * to a remote host. You will need to be able to generate multiple of these which meet Eq and
+ * implement Hash to meet the PeerManager API.
+ *
+ * For efficiency, Clone should be relatively cheap for this type.
+ *
+ * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
+ * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
+ * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
+ * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
+ * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
+ * to simply use another value which is guaranteed to be globally unique instead.
+ */
+typedef struct LDKSocketDescriptor {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Attempts to send some data from the given slice to the peer.
+ *
+ * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
+ * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
+ * called and further write attempts may occur until that time.
+ *
+ * If the returned size is smaller than `data.len()`, a
+ * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
+ * written. Additionally, until a `send_data` event completes fully, no further
+ * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
+ * prevent denial-of-service issues, you should not read or buffer any data from the socket
+ * until then.
+ *
+ * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
+ * (indicating that read events should be paused to prevent DoS in the send buffer),
+ * `resume_read` may be set indicating that read events on this descriptor should resume. A
+ * `resume_read` of false carries no meaning, and should not cause any action.
+ */
+ uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
+ /**
+ * Disconnect the socket pointed to by this SocketDescriptor.
+ *
+ * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
+ * call (doing so is a noop).
+ */
+ void (*disconnect_socket)(void *this_arg);
+ /**
+ * Checks if two objects are equal given this object's this_arg pointer and another object.
+ */
+ bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
+ /**
+ * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
+ * This is used, for example, for inclusion of this object in a hash map.
+ */
+ uint64_t (*hash)(const void *this_arg);
+ /**
+ * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
+ * The new SocketDescriptor is provided, and should be mutated as needed to perform a
+ * deep copy of the object pointed to by this_arg or avoid any double-freeing.
+ */
+ void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKSocketDescriptor;
+
+
+
+/**
+ * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
+ * socket events into messages which it passes on to its [`MessageHandler`].
+ *
+ * Locks are taken internally, so you must never assume that reentrancy from a
+ * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
+ *
+ * Calls to [`read_event`] will decode relevant messages and pass them to the
+ * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
+ * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
+ * [`PeerManager`] functions related to the same connection must occur only in serial, making new
+ * calls only after previous ones have returned.
+ *
+ * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
+ * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
+ * essentially you should default to using a SimpleRefPeerManager, and use a
+ * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
+ * you're using lightning-net-tokio.
+ *
+ * [`read_event`]: PeerManager::read_event
+ */
+typedef struct MUST_USE_STRUCT LDKPeerManager {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativePeerManager *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKPeerManager;
+
+
+
+/**
+ * Static channel fields used to build transactions given per-commitment fields, organized by
+ * broadcaster/countersignatory.
+ *
+ * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
+ * as_holder_broadcastable and as_counterparty_broadcastable functions.
+ */
+typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeDirectedChannelTransactionParameters *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKDirectedChannelTransactionParameters;
+
+
+
+/**
+ * A channel descriptor for a hop along a payment path.
+ */
+typedef struct MUST_USE_STRUCT LDKRouteHintHop {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeRouteHintHop *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKRouteHintHop;
+
+
+
+/**
+ * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
+ * This exists only to make accessing a RwLock<NetworkGraph> possible from
+ * the C bindings, as it can be done directly in Rust code.
+ */
+typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeLockedNetworkGraph *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKLockedNetworkGraph;
+
+
+
+/**
+ * Receives and validates network updates from peers,
+ * stores authentic and relevant data as a network graph.
+ * This network graph is then used for routing payments.
+ * Provides interface to help with initial routing sync by
+ * serving historical announcements.
+ */
+typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeNetGraphMsgHandler *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKNetGraphMsgHandler;
+
+
+
+/**
+ * FilesystemPersister persists channel data on disk, where each channel's
+ * data is stored in a file named after its funding outpoint.
+ *
+ * Warning: this module does the best it can with calls to persist data, but it
+ * can only guarantee that the data is passed to the drive. It is up to the
+ * drive manufacturers to do the actual persistence properly, which they often
+ * don't (especially on consumer-grade hardware). Therefore, it is up to the
+ * user to validate their entire storage stack, to ensure the writes are
+ * persistent.
+ * Corollary: especially when dealing with larger amounts of money, it is best
+ * practice to have multiple channel data backups and not rely only on one
+ * FilesystemPersister.
+ */
+typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeFilesystemPersister *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKFilesystemPersister;
+
+
+
+/**
+ * BackgroundProcessor takes care of tasks that (1) need to happen periodically to keep
+ * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
+ * responsibilities are:
+ * * Monitoring whether the ChannelManager needs to be re-persisted to disk, and if so,
+ * writing it to disk/backups by invoking the callback given to it at startup.
+ * ChannelManager persistence should be done in the background.
+ * * Calling `ChannelManager::timer_tick_occurred()` and
+ * `PeerManager::timer_tick_occurred()` every minute (can be done in the
+ * background).
+ *
+ * Note that if ChannelManager persistence fails and the persisted manager becomes out-of-date,
+ * then there is a risk of channels force-closing on startup when the manager realizes it's
+ * outdated. However, as long as `ChannelMonitor` backups are sound, no funds besides those used
+ * for unilateral chain closure fees are at risk.
+ */
+typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeBackgroundProcessor *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKBackgroundProcessor;
+
+/**
+ * Trait which handles persisting a [`ChannelManager`] to disk.
+ *
+ * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
+ */
+typedef struct LDKChannelManagerPersister {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
+ * (which will cause the [`BackgroundProcessor`] which called this method to exit.
+ *
+ * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
+ */
+ struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKChannelManagerPersister;
+
+
+
+/**
+ * Data of the `RawInvoice` that is encoded in the data part
+ */
+typedef struct MUST_USE_STRUCT LDKRawDataPart {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeRawDataPart *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKRawDataPart;
+
+
+
+/**
+ * SHA-256 hash
+ */
+typedef struct MUST_USE_STRUCT LDKSha256 {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeSha256 *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKSha256;
+
+
+
+/**
+ * `min_final_cltv_expiry` to use for the last HTLC in the route
+ */
+typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeMinFinalCltvExpiry *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKMinFinalCltvExpiry;
+
+/**
+ * Integer in the range `0..32`
+ */
+typedef struct LDKu5 {
+ uint8_t _0;
+} LDKu5;
+
+/**
+ * A 20-byte byte array.
+ */
+typedef struct LDKTwentyBytes {
+ /**
+ * The twenty bytes
+ */
+ uint8_t data[20];
+} LDKTwentyBytes;
+
+/**
+ * Fallback address in case no LN payment is possible
+ */
+typedef enum LDKFallback_Tag {
+ LDKFallback_SegWitProgram,
+ LDKFallback_PubKeyHash,
+ LDKFallback_ScriptHash,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKFallback_Sentinel,
+} LDKFallback_Tag;
+
+typedef struct LDKFallback_LDKSegWitProgram_Body {
+ struct LDKu5 version;
+ struct LDKCVec_u8Z program;
+} LDKFallback_LDKSegWitProgram_Body;
+
+typedef struct MUST_USE_STRUCT LDKFallback {
+ LDKFallback_Tag tag;
+ union {
+ LDKFallback_LDKSegWitProgram_Body seg_wit_program;
+ struct {
+ struct LDKTwentyBytes pub_key_hash;
+ };
+ struct {
+ struct LDKTwentyBytes script_hash;
+ };
+ };
+} LDKFallback;
+
+extern const uintptr_t MAX_BUF_SIZE;
+
+extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
+
+extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
+
+extern const uint32_t ANTI_REORG_DELAY;
+
+extern const uint16_t BREAKDOWN_TIMEOUT;
+
+extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
+
+extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
+
+extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
+
+extern const uint64_t DEFAULT_EXPIRY_TIME;
+
+extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
+
+extern const uint8_t TAG_PAYMENT_HASH;
+
+extern const uint8_t TAG_DESCRIPTION;
+
+extern const uint8_t TAG_PAYEE_PUB_KEY;
+
+extern const uint8_t TAG_DESCRIPTION_HASH;
+
+extern const uint8_t TAG_EXPIRY_TIME;
+
+extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
+
+extern const uint8_t TAG_FALLBACK;
+
+extern const uint8_t TAG_PRIVATE_ROUTE;
+
+extern const uint8_t TAG_PAYMENT_SECRET;
+
+extern const uint8_t TAG_FEATURES;
+
+struct LDKStr _ldk_get_compiled_version(void);
+
+struct LDKStr _ldk_c_bindings_get_compiled_version(void);
+
+/**
+ * Frees the data buffer, if data_is_owned is set and datalen > 0.
+ */
+void Transaction_free(struct LDKTransaction _res);
+
+/**
+ * Convenience function for constructing a new TxOut
+ */
+struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
+
+/**
+ * Frees the data pointed to by script_pubkey.
+ */