bool chars_is_owned;
} LDKStr;
+/**
+ * Represents an error returned from the bech32 library during validation of some bech32 data
+ */
+typedef enum LDKBech32Error_Tag {
+ /**
+ * String does not contain the separator character
+ */
+ LDKBech32Error_MissingSeparator,
+ /**
+ * The checksum does not match the rest of the data
+ */
+ LDKBech32Error_InvalidChecksum,
+ /**
+ * The data or human-readable part is too long or too short
+ */
+ LDKBech32Error_InvalidLength,
+ /**
+ * Some part of the string contains an invalid character
+ */
+ LDKBech32Error_InvalidChar,
+ /**
+ * Some part of the data has an invalid value
+ */
+ LDKBech32Error_InvalidData,
+ /**
+ * The bit conversion failed due to a padding issue
+ */
+ LDKBech32Error_InvalidPadding,
+ /**
+ * The whole string must be of one case
+ */
+ LDKBech32Error_MixedCase,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKBech32Error_Sentinel,
+} LDKBech32Error_Tag;
+
+typedef struct LDKBech32Error {
+ LDKBech32Error_Tag tag;
+ union {
+ struct {
+ uint32_t invalid_char;
+ };
+ struct {
+ uint8_t invalid_data;
+ };
+ };
+} LDKBech32Error;
+
/**
* A serialized transaction, in (pointer, length) form.
*
};
} LDKPaymentPurpose;
+
+
+/**
+ * Features used within the channel_type field in an OpenChannel message.
+ *
+ * A channel is always of some known \"type\", describing the transaction formats used and the exact
+ * semantics of our interaction with our peer.
+ *
+ * Note that because a channel is a specific type which is proposed by the opener and accepted by
+ * the counterparty, only required features are allowed here.
+ *
+ * This is serialized differently from other feature types - it is not prefixed by a length, and
+ * thus must only appear inside a TLV where its length is known in advance.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
+ /**
+ * 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.
+ */
+ LDKnativeChannelTypeFeatures *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;
+} LDKChannelTypeFeatures;
+
/**
* An Event which you should probably take some action in response to.
*
*/
struct LDKThirtyTwoBytes channel_id;
/**
- * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
- * an inbound channel. This will always be zero for objects serialized with LDK versions
- * prior to 0.0.102.
+ * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
+ * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
+ * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
+ * `user_channel_id` will be 0 for an inbound channel.
+ * This will always be zero for objects serialized with LDK versions prior to 0.0.102.
*
* [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
*/
uint64_t user_channel_id;
/**
* Our starting balance in the channel if the request is accepted, in milli-satoshi.
*/
uint64_t push_msat;
+ /**
+ * The features that this channel will operate with. If you reject the channel, a
+ * well-behaved counterparty may automatically re-attempt the channel with a new set of
+ * feature flags.
+ *
+ * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
+ * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
+ * 0.0.106.
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ */
+ struct LDKChannelTypeFeatures channel_type;
} LDKEvent_LDKOpenChannelRequest_Body;
typedef struct MUST_USE_STRUCT LDKEvent {
bool is_owned;
} LDKReplyChannelRange;
+
+
+/**
+ * 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;
+
/**
* An event generated by ChannelManager which indicates a message should be sent to a peer (or
* broadcast to most peers).
* emitted during processing of the query.
*/
LDKMessageSendEvent_SendReplyChannelRange,
+ /**
+ * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
+ * enable receiving gossip messages from the peer.
+ */
+ LDKMessageSendEvent_SendGossipTimestampFilter,
/**
* Must be last for serialization purposes
*/
struct LDKReplyChannelRange msg;
} LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
+typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
+ /**
+ * The node_id of this message recipient
+ */
+ struct LDKPublicKey node_id;
+ /**
+ * The gossip_timestamp_filter which should be sent.
+ */
+ struct LDKGossipTimestampFilter msg;
+} LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
+
typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
LDKMessageSendEvent_Tag tag;
union {
LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
+ LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
};
} LDKMessageSendEvent;
/**
- * Parameters for configuring [`ProbabilisticScorer`].
+ * Represents the network as nodes and channels between them
*/
-typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
+typedef struct MUST_USE_STRUCT LDKNetworkGraph {
/**
* 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.
*/
- LDKnativeProbabilisticScoringParameters *inner;
+ LDKnativeNetworkGraph *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;
-} LDKProbabilisticScoringParameters;
+} LDKNetworkGraph;
+
+
+
+/**
+ * [`Score`] implementation using channel success probability distributions.
+ *
+ * Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
+ * and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
+ * distributions are defined based on knowledge learned from successful and unsuccessful attempts.
+ * Then the negative `log10` of the success probability is used to determine the cost of routing a
+ * specific HTLC amount through a channel.
+ *
+ * Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
+ * possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
+ * [`ProbabilisticScoringParameters`] for details.
+ *
+ * Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
+ * with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
+ * volume are more likely to experience failed payment paths, which would need to be retried.
+ *
+ * # Note
+ *
+ * Mixing the `no-std` feature between serialization and deserialization results in undefined
+ * behavior.
+ *
+ * [1]: https://arxiv.org/abs/2107.05322
+ */
+typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
+ /**
+ * 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.
+ */
+ LDKnativeProbabilisticScorer *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;
+} LDKProbabilisticScorer;
/**
- * The contents of CResult_ProbabilisticScoringParametersDecodeErrorZ
+ * The contents of CResult_ProbabilisticScorerDecodeErrorZ
*/
-typedef union LDKCResult_ProbabilisticScoringParametersDecodeErrorZPtr {
+typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKProbabilisticScoringParameters *result;
+ struct LDKProbabilisticScorer *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_ProbabilisticScoringParametersDecodeErrorZPtr;
+} LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
/**
- * A CResult_ProbabilisticScoringParametersDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::scoring::ProbabilisticScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::scoring::ProbabilisticScorer 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_ProbabilisticScoringParametersDecodeErrorZ {
+typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
/**
- * The contents of this CResult_ProbabilisticScoringParametersDecodeErrorZ, accessible via either
+ * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_ProbabilisticScoringParametersDecodeErrorZPtr contents;
+ union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
/**
- * Whether this CResult_ProbabilisticScoringParametersDecodeErrorZ represents a success state.
+ * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_ProbabilisticScoringParametersDecodeErrorZ;
+} LDKCResult_ProbabilisticScorerDecodeErrorZ;
bool result_ok;
} LDKCResult_InvoiceFeaturesDecodeErrorZ;
-
-
-/**
- * Features used within the channel_type field in an OpenChannel message.
- *
- * A channel is always of some known \"type\", describing the transaction formats used and the exact
- * semantics of our interaction with our peer.
- *
- * Note that because a channel is a specific type which is proposed by the opener and accepted by
- * the counterparty, only required features are allowed here.
- *
- * This is serialized differently from other feature types - it is not prefixed by a length, and
- * thus must only appear inside a TLV where its length is known in advance.
- */
-typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
- /**
- * 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.
- */
- LDKnativeChannelTypeFeatures *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;
-} LDKChannelTypeFeatures;
-
/**
* The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
*/
} LDKCResult_PaymentIdPaymentErrorZ;
/**
- * The contents of CResult_SiPrefixNoneZ
+ * Sub-errors which don't have specific information in them use this type.
+ */
+typedef struct LDKError {
+ /**
+ * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
+ */
+ uint8_t _dummy;
+} LDKError;
+
+/**
+ * Errors that indicate what is wrong with the invoice. They have some granularity for debug
+ * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
+ */
+typedef enum LDKParseError_Tag {
+ LDKParseError_Bech32Error,
+ LDKParseError_ParseAmountError,
+ LDKParseError_MalformedSignature,
+ LDKParseError_BadPrefix,
+ LDKParseError_UnknownCurrency,
+ LDKParseError_UnknownSiPrefix,
+ LDKParseError_MalformedHRP,
+ LDKParseError_TooShortDataPart,
+ LDKParseError_UnexpectedEndOfTaggedFields,
+ LDKParseError_DescriptionDecodeError,
+ LDKParseError_PaddingError,
+ LDKParseError_IntegerOverflowError,
+ LDKParseError_InvalidSegWitProgramLength,
+ LDKParseError_InvalidPubKeyHashLength,
+ LDKParseError_InvalidScriptHashLength,
+ LDKParseError_InvalidRecoveryId,
+ LDKParseError_InvalidSliceLength,
+ /**
+ * Not an error, but used internally to signal that a part of the invoice should be ignored
+ * according to BOLT11
+ */
+ LDKParseError_Skip,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKParseError_Sentinel,
+} LDKParseError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKParseError {
+ LDKParseError_Tag tag;
+ union {
+ struct {
+ struct LDKBech32Error bech32_error;
+ };
+ struct {
+ struct LDKError parse_amount_error;
+ };
+ struct {
+ enum LDKSecp256k1Error malformed_signature;
+ };
+ struct {
+ struct LDKError description_decode_error;
+ };
+ struct {
+ struct LDKStr invalid_slice_length;
+ };
+ };
+} LDKParseError;
+
+/**
+ * The contents of CResult_SiPrefixParseErrorZ
*/
-typedef union LDKCResult_SiPrefixNoneZPtr {
+typedef union LDKCResult_SiPrefixParseErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
enum LDKSiPrefix *result;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void *err;
-} LDKCResult_SiPrefixNoneZPtr;
+ struct LDKParseError *err;
+} LDKCResult_SiPrefixParseErrorZPtr;
/**
- * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
+ * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_SiPrefixNoneZ {
+typedef struct LDKCResult_SiPrefixParseErrorZ {
/**
- * The contents of this CResult_SiPrefixNoneZ, accessible via either
+ * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_SiPrefixNoneZPtr contents;
+ union LDKCResult_SiPrefixParseErrorZPtr contents;
/**
- * Whether this CResult_SiPrefixNoneZ represents a success state.
+ * Whether this CResult_SiPrefixParseErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_SiPrefixNoneZ;
+} LDKCResult_SiPrefixParseErrorZ;
} LDKInvoice;
/**
- * The contents of CResult_InvoiceNoneZ
+ * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
+ * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
+ * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
+ */
+typedef enum LDKParseOrSemanticError_Tag {
+ /**
+ * The invoice couldn't be decoded
+ */
+ LDKParseOrSemanticError_ParseError,
+ /**
+ * The invoice could be decoded but violates the BOLT11 standard
+ */
+ LDKParseOrSemanticError_SemanticError,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKParseOrSemanticError_Sentinel,
+} LDKParseOrSemanticError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
+ LDKParseOrSemanticError_Tag tag;
+ union {
+ struct {
+ struct LDKParseError parse_error;
+ };
+ struct {
+ enum LDKSemanticError semantic_error;
+ };
+ };
+} LDKParseOrSemanticError;
+
+/**
+ * The contents of CResult_InvoiceParseOrSemanticErrorZ
*/
-typedef union LDKCResult_InvoiceNoneZPtr {
+typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
struct LDKInvoice *result;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void *err;
-} LDKCResult_InvoiceNoneZPtr;
+ struct LDKParseOrSemanticError *err;
+} LDKCResult_InvoiceParseOrSemanticErrorZPtr;
/**
- * A CResult_InvoiceNoneZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::Invoice on success and a () on failure.
+ * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_InvoiceNoneZ {
+typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
/**
- * The contents of this CResult_InvoiceNoneZ, accessible via either
+ * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_InvoiceNoneZPtr contents;
+ union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
/**
- * Whether this CResult_InvoiceNoneZ represents a success state.
+ * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_InvoiceNoneZ;
+} LDKCResult_InvoiceParseOrSemanticErrorZ;
} LDKSignedRawInvoice;
/**
- * The contents of CResult_SignedRawInvoiceNoneZ
+ * The contents of CResult_SignedRawInvoiceParseErrorZ
*/
-typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
+typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
struct LDKSignedRawInvoice *result;
/**
- * Note that this value is always NULL, as there are no contents in the Err variant
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void *err;
-} LDKCResult_SignedRawInvoiceNoneZPtr;
+ struct LDKParseError *err;
+} LDKCResult_SignedRawInvoiceParseErrorZPtr;
/**
- * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
+ * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_SignedRawInvoiceNoneZ {
+typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
/**
- * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
+ * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_SignedRawInvoiceNoneZPtr contents;
+ union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
/**
- * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
+ * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_SignedRawInvoiceNoneZ;
+} LDKCResult_SignedRawInvoiceParseErrorZ;
uintptr_t datalen;
} LDKCVec_PublicKeyZ;
+/**
+ * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
+ */
+typedef enum LDKCOption_NetAddressZ_Tag {
+ /**
+ * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
+ */
+ LDKCOption_NetAddressZ_Some,
+ /**
+ * When we're in this state, this COption_NetAddressZ contains nothing
+ */
+ LDKCOption_NetAddressZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_NetAddressZ_Sentinel,
+} LDKCOption_NetAddressZ_Tag;
+
+typedef struct LDKCOption_NetAddressZ {
+ LDKCOption_NetAddressZ_Tag tag;
+ union {
+ struct {
+ struct LDKNetAddress some;
+ };
+ };
+} LDKCOption_NetAddressZ;
+
/**
bool result_ok;
} LDKCResult_NodeInfoDecodeErrorZ;
-
-
-/**
- * Represents the network as nodes and channels between them
- */
-typedef struct MUST_USE_STRUCT LDKNetworkGraph {
- /**
- * 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.
- */
- LDKnativeNetworkGraph *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;
-} LDKNetworkGraph;
-
/**
* The contents of CResult_NetworkGraphDecodeErrorZ
*/
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.
+ * The contents of CResult_GossipTimestampFilterDecodeErrorZ
*/
-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 {
+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.
* 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);
+ void (*peer_connected)(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
+/**
+ * Parameters for configuring [`ProbabilisticScorer`].
+ *
+ * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
+ * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
+ */
+typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
+ /**
+ * 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.
+ */
+ LDKnativeProbabilisticScoringParameters *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;
+} LDKProbabilisticScoringParameters;
+
+
+
/**
* FilesystemPersister persists channel data on disk, where each channel's
* data is stored in a file named after its funding outpoint.
} LDKBackgroundProcessor;
/**
- * Trait which handles persisting a [`ChannelManager`] to disk.
- *
- * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
+ * Trait that handles persisting a [`ChannelManager`] and [`NetworkGraph`] to disk.
*/
-typedef struct LDKChannelManagerPersister {
+typedef struct LDKPersister {
/**
* 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
+ * (which will cause the [`BackgroundProcessor`] which called this method to exit).
*/
struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
+ /**
+ * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
+ */
+ struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
/**
* 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;
+} LDKPersister;
struct LDKStr _ldk_c_bindings_get_compiled_version(void);
+/**
+ * Creates a new Bech32Error which has the same data as `orig`
+ */
+struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
+
+/**
+ * Releases any memory held by the given `Bech32Error` (which is currently none)
+ */
+void Bech32Error_free(struct LDKBech32Error o);
+
/**
* Frees the data buffer, if data_is_owned is set and datalen > 0.
*/
*/
void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
+/**
+ * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_PublicKeyErrorZ in the success state.
*/
*/
void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
+/**
+ * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
*/
*/
void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
+/**
+ * Creates a new CResult_ScoringParametersDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_clone(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_ScorerDecodeErrorZ in the success state.
*/
void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
/**
- * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the success state.
+ * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
*/
-struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(struct LDKProbabilisticScoringParameters o);
+struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
/**
- * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the error state.
+ * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
*/
-struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_ProbabilisticScoringParametersDecodeErrorZ.
- */
-void CResult_ProbabilisticScoringParametersDecodeErrorZ_free(struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ _res);
+bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
*/
-struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(const struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR orig);
+void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
/**
* Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
*/
void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
+/**
+ * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_SignDecodeErrorZ in the success state.
*/
*/
void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
+/**
+ * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
+
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_SiPrefixNoneZ in the success state.
+ * Creates a new CResult_SiPrefixParseErrorZ in the success state.
*/
-struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
+struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
/**
- * Creates a new CResult_SiPrefixNoneZ in the error state.
+ * Creates a new CResult_SiPrefixParseErrorZ in the error state.
*/
-struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
+struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_SiPrefixNoneZ_is_ok(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR o);
+bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_SiPrefixNoneZ.
+ * Frees any resources used by the CResult_SiPrefixParseErrorZ.
*/
-void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
+void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
/**
- * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
+ * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
+struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_InvoiceNoneZ in the success state.
+ * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
*/
-struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
+struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
/**
- * Creates a new CResult_InvoiceNoneZ in the error state.
+ * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
*/
-struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
+struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_InvoiceNoneZ_is_ok(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR o);
+bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_InvoiceNoneZ.
+ * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
*/
-void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
+void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
/**
- * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
+ * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
+struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
+ * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
*/
-struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
+struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
/**
- * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
+ * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
*/
-struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
+struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_SignedRawInvoiceNoneZ_is_ok(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR o);
+bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
+ * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
*/
-void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
+void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
/**
- * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
+ * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
+struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
/**
* Creates a new tuple which has the same data as `orig`
*/
void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
+/**
+ * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
+ */
+struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
+
+/**
+ * Constructs a new COption_NetAddressZ containing nothing
+ */
+struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
+ */
+void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
+
+/**
+ * Creates a new COption_NetAddressZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
*/
/**
* Utility method to constructs a new OpenChannelRequest-variant Event
*/
-struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat);
+struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat, struct LDKChannelTypeFeatures channel_type);
/**
* Serialize the Event object into a byte array which can be read by Event_read
*/
struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
+/**
+ * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
+
/**
* Calls the free function if one is set
*/
*/
void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
+/**
+ * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
+ * BOLTs) option for outbound private channels. This provides better privacy by not including
+ * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
+ * relay HTLCs to us using the channel's SCID alias.
+ *
+ * If this option is set, channels may be created that will not be readable by LDK versions
+ * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
+ * [`DecodeError:InvalidValue`].
+ *
+ * Note that setting this to true does *not* prevent us from opening channels with
+ * counterparties that do not support the `scid_alias` option; we will simply fall back to a
+ * private channel without that option.
+ *
+ * Ignored if the channel is negotiated to be announced, see
+ * [`ChannelConfig::announced_channel`] and
+ * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
+ *
+ * Default value: false. This value is likely to change to true in the future.
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
+ */
+bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
+
+/**
+ * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
+ * BOLTs) option for outbound private channels. This provides better privacy by not including
+ * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
+ * relay HTLCs to us using the channel's SCID alias.
+ *
+ * If this option is set, channels may be created that will not be readable by LDK versions
+ * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
+ * [`DecodeError:InvalidValue`].
+ *
+ * Note that setting this to true does *not* prevent us from opening channels with
+ * counterparties that do not support the `scid_alias` option; we will simply fall back to a
+ * private channel without that option.
+ *
+ * Ignored if the channel is negotiated to be announced, see
+ * [`ChannelConfig::announced_channel`] and
+ * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
+ *
+ * Default value: false. This value is likely to change to true in the future.
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
+ */
+void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
+
/**
* Constructs a new ChannelHandshakeConfig given each field
*/
-MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg);
+MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg, bool negotiate_scid_privacy_arg);
/**
* Creates a copy of the ChannelHandshakeConfig
*/
void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
+/**
+ * The features which this channel operates with. See individual features for more info.
+ *
+ * `None` until negotiation completes and the channel type is finalized.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
+
+/**
+ * The features which this channel operates with. See individual features for more info.
+ *
+ * `None` until negotiation completes and the channel type is finalized.
+ *
+ * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
+
/**
* The position of the funding transaction in the chain. None if the funding transaction has
* not yet been confirmed and the channel fully opened.
+ *
+ * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
+ * payments instead of this. See [`get_inbound_payment_scid`].
+ *
+ * [`inbound_scid_alias`]: Self::inbound_scid_alias
+ * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
*/
struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
/**
* The position of the funding transaction in the chain. None if the funding transaction has
* not yet been confirmed and the channel fully opened.
+ *
+ * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
+ * payments instead of this. See [`get_inbound_payment_scid`].
+ *
+ * [`inbound_scid_alias`]: Self::inbound_scid_alias
+ * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
*/
void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
+/**
+ * An optional [`short_channel_id`] alias for this channel, randomly generated by our
+ * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
+ * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
+ * when they see a payment to be routed to us.
+ *
+ * Our counterparty may choose to rotate this value at any time, though will always recognize
+ * previous values for inbound payment forwarding.
+ *
+ * [`short_channel_id`]: Self::short_channel_id
+ */
+struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
+
+/**
+ * An optional [`short_channel_id`] alias for this channel, randomly generated by our
+ * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
+ * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
+ * when they see a payment to be routed to us.
+ *
+ * Our counterparty may choose to rotate this value at any time, though will always recognize
+ * previous values for inbound payment forwarding.
+ *
+ * [`short_channel_id`]: Self::short_channel_id
+ */
+void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
+
/**
* The value, in satoshis, of this channel as appears in the funding output
*/
/**
* Constructs a new ChannelDetails given each field
*/
-MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg);
+MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg);
/**
* Creates a copy of the ChannelDetails
*/
struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
+/**
+ * Gets the current SCID which should be used to identify this channel for inbound payments.
+ * This should be used for providing invoice hints or in any other context where our
+ * counterparty will forward a payment to us.
+ *
+ * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
+ * [`ChannelDetails::short_channel_id`]. See those for more information.
+ */
+MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
+
/**
* Frees any resources used by the PaymentSendFailure
*/
*/
MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
+/**
+ * Creates a copy of the PhantomRouteHints
+ */
+struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
+
/**
* Constructs a new ChannelManager to hold several channels and route between them.
*
*
* The `temporary_channel_id` parameter indicates which inbound channel should be accepted.
*
- * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
+ * For inbound channels, the `user_channel_id` parameter will be provided back in
+ * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
+ * with which `accept_inbound_channel` call.
+ *
+ * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
+ * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
*/
-MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32]);
+MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], uint64_t user_channel_id);
/**
* Gets a payment secret and payment hash for use in an invoice given to a third party wishing
* Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
* serialized state with LDK node(s) running 0.0.103 and earlier.
*
+ * May panic if `invoice_expiry_delta_secs` is greater than one year.
+ *
* # Note
* This method is deprecated and will be removed soon.
*
* If you need exact expiry semantics, you should enforce them upon receipt of
* [`PaymentReceived`].
*
- * May panic if `invoice_expiry_delta_secs` is greater than one year.
- *
* Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
* set to at least [`MIN_FINAL_CLTV_EXPIRY`].
*
* Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
* serialized state with LDK node(s) running 0.0.103 and earlier.
*
+ * May panic if `invoice_expiry_delta_secs` is greater than one year.
+ *
* # Note
* This method is deprecated and will be removed soon.
*
*/
void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
+/**
+ * The receipient's network address. This adds the option to report a remote IP address
+ * back to a connecting peer using the init message. A node can decide to use that information
+ * to discover a potential update to its public IPv4 address (NAT) and use
+ * that for a node_announcement update message containing the new address.
+ */
+struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
+
+/**
+ * The receipient's network address. This adds the option to report a remote IP address
+ * back to a connecting peer using the init message. A node can decide to use that information
+ * to discover a potential update to its public IPv4 address (NAT) and use
+ * that for a node_announcement update message containing the new address.
+ */
+void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val);
+
/**
* Constructs a new Init given each field
*/
-MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
+MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg);
/**
* Creates a copy of the Init
*/
void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
+/**
+ * If set, provides a short_channel_id alias for this channel. The sender will accept payments
+ * to be forwarded over this SCID and forward them to this messages' recipient.
+ */
+struct LDKCOption_u64Z FundingLocked_get_short_channel_id_alias(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
+
+/**
+ * If set, provides a short_channel_id alias for this channel. The sender will accept payments
+ * to be forwarded over this SCID and forward them to this messages' recipient.
+ */
+void FundingLocked_set_short_channel_id_alias(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
+
/**
* Constructs a new FundingLocked given each field
*/
-MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
+MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg);
/**
* Creates a copy of the FundingLocked
MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
/**
- * Indicates a new outbound connection has been established to a node with the given node_id.
+ * Indicates a new outbound connection has been established to a node with the given node_id
+ * and an optional remote network address.
+ *
+ * The remote network address adds the option to report a remote IP address back to a connecting
+ * peer using the init message.
+ * The user should pass the remote network address of the host they are connected to.
+ *
* Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
* descriptor but must disconnect the connection immediately.
*
*
* [`socket_disconnected()`]: PeerManager::socket_disconnected
*/
-MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor);
+MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address);
/**
- * Indicates a new inbound connection has been established.
+ * Indicates a new inbound connection has been established to a node with an optional remote
+ * network address.
+ *
+ * The remote network address adds the option to report a remote IP address back to a connecting
+ * peer using the init message.
+ * The user should pass the remote network address of the host they are connected to.
*
* May refuse the connection by returning an Err, but will never write bytes to the remote end
* (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
*
* [`socket_disconnected()`]: PeerManager::socket_disconnected
*/
-MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
+MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address);
/**
* Indicates that there is room to write data to the given socket descriptor.
* Send pings to each peer and disconnect those which did not respond to the last round of
* pings.
*
- * This may be called on any timescale you want, however, roughly once every five to ten
- * seconds is preferred. The call rate determines both how often we send a ping to our peers
- * and how much time they have to respond before we disconnect them.
+ * This may be called on any timescale you want, however, roughly once every ten seconds is
+ * preferred. The call rate determines both how often we send a ping to our peers and how much
+ * time they have to respond before we disconnect them.
*
* May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
* issues!
struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
/**
- * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
+ * Set this feature as optional.
*/
-void ShutdownScript_free(struct LDKShutdownScript this_obj);
+void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Creates a copy of the ShutdownScript
+ * Set this feature as required.
*/
-struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
+void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
+ * Checks if this feature is supported.
*/
-void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
+MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * The script that did not meet the requirements from [BOLT #2].
- *
- * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
+ * Set this feature as optional.
*/
-struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
+void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * The script that did not meet the requirements from [BOLT #2].
- *
- * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
+ * Set this feature as required.
*/
-void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
+void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Constructs a new InvalidShutdownScript given each field
+ * Checks if this feature is supported.
*/
-MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
+MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Creates a copy of the InvalidShutdownScript
+ * Checks if this feature is required.
*/
-struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
+MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
+ * Checks if this feature is required.
*/
-struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
+MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Read a ShutdownScript from a byte array, created by ShutdownScript_write
+ * Set this feature as optional.
*/
-struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
+void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
+ * Set this feature as required.
*/
-MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
+void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Generates a P2WSH script pubkey from the given [`WScriptHash`].
+ * Checks if this feature is supported.
*/
-MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
+MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Generates a witness script pubkey from the given segwit version and program.
- *
- * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
- * [`ShutdownScript::new_p2wsh`] instead.
- *
- * # Errors
- *
- * This function may return an error if `program` is invalid for the segwit `version`.
+ * Set this feature as optional.
*/
-MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
+void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Converts the shutdown script into the underlying [`Script`].
+ * Set this feature as required.
*/
-MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
+void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
- *
- * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * Checks if this feature is supported.
*/
-MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
+MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
- *
- * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
+ * Set this feature as optional.
*/
-MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
+void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Calls the free function if one is set
+ * Set this feature as required.
*/
-void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
+void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Calls the free function if one is set
+ * Checks if this feature is supported.
*/
-void Type_free(struct LDKType this_ptr);
+MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
+ * Checks if this feature is required.
*/
-void NodeId_free(struct LDKNodeId this_obj);
+MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Creates a copy of the NodeId
+ * Checks if this feature is required.
*/
-struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
+MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Create a new NodeId from a public key
+ * Set this feature as optional.
*/
-MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
+void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Get the public key slice from this NodeId
+ * Set this feature as required.
*/
-MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
+void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Checks if two NodeIds contain equal inner contents.
+ * Checks if this feature is supported.
*/
-uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
+MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Serialize the NodeId object into a byte array which can be read by NodeId_read
+ * Set this feature as optional.
*/
-struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
+void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Read a NodeId from a byte array, created by NodeId_write
+ * Set this feature as required.
*/
-struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
+void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
+ * Checks if this feature is supported.
*/
-void NetworkGraph_free(struct LDKNetworkGraph this_obj);
+MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Creates a copy of the NetworkGraph
+ * Checks if this feature is required.
*/
-struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
+MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
+ * Checks if this feature is required.
*/
-void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
+MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Frees any resources used by the NetworkUpdate
+ * Set this feature as optional.
*/
-void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
+void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Creates a copy of the NetworkUpdate
+ * Set this feature as required.
*/
-struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
+void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
+ * Checks if this feature is supported.
*/
-struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
+MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
/**
- * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
+ * Set this feature as optional.
*/
-struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
+void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Utility method to constructs a new NodeFailure-variant NetworkUpdate
+ * Set this feature as required.
*/
-struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
+void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
+ * Checks if this feature is supported.
*/
-struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
+MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
/**
- * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
+ * Set this feature as optional.
*/
-struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
+void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
/**
- * Constructs a new EventHandler which calls the relevant methods on this_arg.
- * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
+ * Set this feature as required.
*/
-struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
+void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
/**
- * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
+ * Checks if this feature is supported.
*/
-void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
+MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
/**
- * Creates a new tracker of the actual state of the network of channels and nodes,
- * assuming an existing Network Graph.
- * Chain monitor is used to make sure announced channels exist on-chain,
- * channel data is correct, and that the announcement is signed with
- * channel owners' keys.
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as optional.
+ */
+void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
+ */
+void ShutdownScript_free(struct LDKShutdownScript this_obj);
+
+/**
+ * Creates a copy of the ShutdownScript
+ */
+struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
+
+/**
+ * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
+ */
+void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
+
+/**
+ * The script that did not meet the requirements from [BOLT #2].
+ *
+ * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
+ */
+struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
+
+/**
+ * The script that did not meet the requirements from [BOLT #2].
+ *
+ * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
+ */
+void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
+
+/**
+ * Constructs a new InvalidShutdownScript given each field
+ */
+MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
+
+/**
+ * Creates a copy of the InvalidShutdownScript
+ */
+struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
+
+/**
+ * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
+ */
+struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
+
+/**
+ * Read a ShutdownScript from a byte array, created by ShutdownScript_write
+ */
+struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
+
+/**
+ * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
+ */
+MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
+
+/**
+ * Generates a P2WSH script pubkey from the given [`WScriptHash`].
+ */
+MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
+
+/**
+ * Generates a witness script pubkey from the given segwit version and program.
+ *
+ * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
+ * [`ShutdownScript::new_p2wsh`] instead.
+ *
+ * # Errors
+ *
+ * This function may return an error if `program` is invalid for the segwit `version`.
+ */
+MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
+
+/**
+ * Converts the shutdown script into the underlying [`Script`].
+ */
+MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
+
+/**
+ * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
+
+/**
+ * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
+ *
+ * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
+ */
+MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
+
+/**
+ * Calls the free function if one is set
+ */
+void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
+
+/**
+ * Calls the free function if one is set
+ */
+void Type_free(struct LDKType this_ptr);
+
+/**
+ * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
+ */
+void NodeId_free(struct LDKNodeId this_obj);
+
+/**
+ * Creates a copy of the NodeId
+ */
+struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
+
+/**
+ * Create a new NodeId from a public key
+ */
+MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
+
+/**
+ * Get the public key slice from this NodeId
+ */
+MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
+
+/**
+ * Checks if two NodeIds contain equal inner contents.
+ */
+uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
+
+/**
+ * Serialize the NodeId object into a byte array which can be read by NodeId_read
+ */
+struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
+
+/**
+ * Read a NodeId from a byte array, created by NodeId_write
+ */
+struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
+
+/**
+ * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
+ */
+void NetworkGraph_free(struct LDKNetworkGraph this_obj);
+
+/**
+ * Creates a copy of the NetworkGraph
+ */
+struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
+
+/**
+ * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
+ */
+void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
+
+/**
+ * Frees any resources used by the NetworkUpdate
+ */
+void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
+
+/**
+ * Creates a copy of the NetworkUpdate
+ */
+struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
+ */
+struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
+
+/**
+ * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
+ */
+struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
+
+/**
+ * Utility method to constructs a new NodeFailure-variant NetworkUpdate
+ */
+struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
+
+/**
+ * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
+ */
+struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
+
+/**
+ * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
+ */
+struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
+
+/**
+ * Constructs a new EventHandler which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
+ */
+struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
+
+/**
+ * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
+ */
+void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
+
+/**
+ * Creates a new tracker of the actual state of the network of channels and nodes,
+ * assuming an existing Network Graph.
+ * Chain monitor is used to make sure announced channels exist on-chain,
+ * channel data is correct, and that the announcement is signed with
+ * channel owners' keys.
*/
MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
*
* Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer);
+struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const uint8_t (*random_seed_bytes)[32]);
/**
* Calls the free function if one is set
void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
/**
- * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
- */
-struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
-
-/**
- * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
+ * Creates a copy of the FixedPenaltyScorer
*/
-struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser);
+struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
/**
* Creates a new scorer using `penalty_msat`.
*/
struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
+/**
+ * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
+ */
+struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
+
+/**
+ * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
+ */
+struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
+
/**
* Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
*/
*/
MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint16_t overuse_penalty_start_1024th_arg, uint64_t overuse_penalty_msat_per_1024th_arg, uint64_t failure_penalty_half_life_arg);
+/**
+ * Creates a copy of the ScoringParameters
+ */
+struct LDKScoringParameters ScoringParameters_clone(const struct LDKScoringParameters *NONNULL_PTR orig);
+
/**
* Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
*/
*/
struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser);
+/**
+ * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
+ */
+void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
+
/**
* Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
*/
void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
/**
- * A multiplier used to determine the amount in msats willing to be paid to avoid routing
- * through a channel, as per multiplying by the negative `log10` of the channel's success
- * probability for a payment.
+ * A fixed penalty in msats to apply to each channel.
+ *
+ * Default value: 500 msat
+ */
+uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
+
+/**
+ * A fixed penalty in msats to apply to each channel.
+ *
+ * Default value: 500 msat
+ */
+void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * A multiplier used in conjunction with the negative `log10` of the channel's success
+ * probability for a payment to determine the liquidity penalty.
*
- * The success probability is determined by the effective channel capacity, the payment amount,
- * and knowledge learned from prior successful and unsuccessful payments. The lower bound of
- * the success probability is 0.01, effectively limiting the penalty to the range
- * `0..=2*liquidity_penalty_multiplier_msat`. The knowledge learned is decayed over time based
- * on [`liquidity_offset_half_life`].
+ * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
+ * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
+ * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
+ * lower bounding the success probability to `0.01`) when the amount falls within the
+ * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
+ * result in a `u64::max_value` penalty, however.
*
- * Default value: 10,000 msat
+ * Default value: 40,000 msat
*
* [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
*/
uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
/**
- * A multiplier used to determine the amount in msats willing to be paid to avoid routing
- * through a channel, as per multiplying by the negative `log10` of the channel's success
- * probability for a payment.
+ * A multiplier used in conjunction with the negative `log10` of the channel's success
+ * probability for a payment to determine the liquidity penalty.
*
- * The success probability is determined by the effective channel capacity, the payment amount,
- * and knowledge learned from prior successful and unsuccessful payments. The lower bound of
- * the success probability is 0.01, effectively limiting the penalty to the range
- * `0..=2*liquidity_penalty_multiplier_msat`. The knowledge learned is decayed over time based
- * on [`liquidity_offset_half_life`].
+ * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
+ * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
+ * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
+ * lower bounding the success probability to `0.01`) when the amount falls within the
+ * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
+ * result in a `u64::max_value` penalty, however.
*
- * Default value: 10,000 msat
+ * Default value: 40,000 msat
*
* [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
*/
*/
void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+/**
+ * A multiplier used in conjunction with a payment amount and the negative `log10` of the
+ * channel's success probability for the payment to determine the amount penalty.
+ *
+ * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
+ * fees plus penalty) for large payments. The penalty is computed as the product of this
+ * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
+ * success probability.
+ *
+ * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
+ *
+ * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
+ * the amount will result in a penalty of the multiplier. And, as the success probability
+ * decreases, the negative `log10` weighting will increase dramatically. For higher success
+ * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
+ * fall below `1`.
+ *
+ * Default value: 256 msat
+ */
+uint64_t ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
+
+/**
+ * A multiplier used in conjunction with a payment amount and the negative `log10` of the
+ * channel's success probability for the payment to determine the amount penalty.
+ *
+ * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
+ * fees plus penalty) for large payments. The penalty is computed as the product of this
+ * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
+ * success probability.
+ *
+ * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
+ *
+ * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
+ * the amount will result in a penalty of the multiplier. And, as the success probability
+ * decreases, the negative `log10` weighting will increase dramatically. For higher success
+ * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
+ * fall below `1`.
+ *
+ * Default value: 256 msat
+ */
+void ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
+
/**
* Constructs a new ProbabilisticScoringParameters given each field
*/
-MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_new(uint64_t liquidity_penalty_multiplier_msat_arg, uint64_t liquidity_offset_half_life_arg);
+MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t liquidity_penalty_multiplier_msat_arg, uint64_t liquidity_offset_half_life_arg, uint64_t amount_penalty_multiplier_msat_arg);
/**
* Creates a copy of the ProbabilisticScoringParameters
struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
/**
- * Serialize the ProbabilisticScoringParameters object into a byte array which can be read by ProbabilisticScoringParameters_read
+ * Creates a new scorer using the given scoring parameters for sending payments from a node
+ * through a network graph.
*/
-struct LDKCVec_u8Z ProbabilisticScoringParameters_write(const struct LDKProbabilisticScoringParameters *NONNULL_PTR obj);
+MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
/**
- * Read a ProbabilisticScoringParameters from a byte array, created by ProbabilisticScoringParameters_write
+ * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
*/
-struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ ProbabilisticScoringParameters_read(struct LDKu8slice ser);
+MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
/**
- * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
+ * Constructs a new Score which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
*/
-MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
+struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
+
+/**
+ * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
+ */
+struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
+
+/**
+ * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
+ */
+struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b);
/**
* Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
*/
MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
+/**
+ * Write the provided `NetworkGraph` to the path provided at `FilesystemPersister`
+ * initialization, within a file called \"network_graph\"
+ */
+MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_network_graph(struct LDKStr data_dir, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
+
/**
* Read `ChannelMonitor`s from disk.
*/
/**
* Calls the free function if one is set
*/
-void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
+void Persister_free(struct LDKPersister this_ptr);
/**
* Start a background thread that takes care of responsibilities enumerated in the [top-level
* documentation].
*
* The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
- * `persist_manager` returns an error. In case of an error, the error is retrieved by calling
+ * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
* either [`join`] or [`stop`].
*
* # Data Persistence
*
- * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
+ * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
* uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
* [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
* provided implementation.
*
- * Typically, users should either implement [`ChannelManagerPersister`] to never return an
+ * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk. See
+ * [`NetworkGraph::write`] for writing out a [`NetworkGraph`]. See [`FilesystemPersister::persist_network_graph`]
+ * for Rust-Lightning's provided implementation.
+ *
+ * Typically, users should either implement [`Persister::persist_manager`] to never return an
* error or call [`join`] and handle any error that may arise. For the latter case,
* `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
*
* [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
* [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
* [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
+ * [`FilesystemPersister::persist_network_graph`]: lightning_persister::FilesystemPersister::persist_network_graph
* [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
+ * [`NetworkGraph::write`]: lightning::routing::network_graph::NetworkGraph#impl-Writeable
*
* Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKChannelManagerPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
+MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
/**
* Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
*/
MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
+/**
+ * Frees any resources used by the ParseError
+ */
+void ParseError_free(struct LDKParseError this_ptr);
+
+/**
+ * Creates a copy of the ParseError
+ */
+struct LDKParseError ParseError_clone(const struct LDKParseError *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new Bech32Error-variant ParseError
+ */
+struct LDKParseError ParseError_bech32_error(struct LDKBech32Error a);
+
+/**
+ * Utility method to constructs a new ParseAmountError-variant ParseError
+ */
+struct LDKParseError ParseError_parse_amount_error(struct LDKError a);
+
+/**
+ * Utility method to constructs a new MalformedSignature-variant ParseError
+ */
+struct LDKParseError ParseError_malformed_signature(enum LDKSecp256k1Error a);
+
+/**
+ * Utility method to constructs a new BadPrefix-variant ParseError
+ */
+struct LDKParseError ParseError_bad_prefix(void);
+
+/**
+ * Utility method to constructs a new UnknownCurrency-variant ParseError
+ */
+struct LDKParseError ParseError_unknown_currency(void);
+
+/**
+ * Utility method to constructs a new UnknownSiPrefix-variant ParseError
+ */
+struct LDKParseError ParseError_unknown_si_prefix(void);
+
+/**
+ * Utility method to constructs a new MalformedHRP-variant ParseError
+ */
+struct LDKParseError ParseError_malformed_hrp(void);
+
+/**
+ * Utility method to constructs a new TooShortDataPart-variant ParseError
+ */
+struct LDKParseError ParseError_too_short_data_part(void);
+
+/**
+ * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
+ */
+struct LDKParseError ParseError_unexpected_end_of_tagged_fields(void);
+
+/**
+ * Utility method to constructs a new DescriptionDecodeError-variant ParseError
+ */
+struct LDKParseError ParseError_description_decode_error(struct LDKError a);
+
+/**
+ * Utility method to constructs a new PaddingError-variant ParseError
+ */
+struct LDKParseError ParseError_padding_error(void);
+
+/**
+ * Utility method to constructs a new IntegerOverflowError-variant ParseError
+ */
+struct LDKParseError ParseError_integer_overflow_error(void);
+
+/**
+ * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
+ */
+struct LDKParseError ParseError_invalid_seg_wit_program_length(void);
+
+/**
+ * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
+ */
+struct LDKParseError ParseError_invalid_pub_key_hash_length(void);
+
+/**
+ * Utility method to constructs a new InvalidScriptHashLength-variant ParseError
+ */
+struct LDKParseError ParseError_invalid_script_hash_length(void);
+
+/**
+ * Utility method to constructs a new InvalidRecoveryId-variant ParseError
+ */
+struct LDKParseError ParseError_invalid_recovery_id(void);
+
+/**
+ * Utility method to constructs a new InvalidSliceLength-variant ParseError
+ */
+struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a);
+
+/**
+ * Utility method to constructs a new Skip-variant ParseError
+ */
+struct LDKParseError ParseError_skip(void);
+
+/**
+ * Frees any resources used by the ParseOrSemanticError
+ */
+void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
+
+/**
+ * Creates a copy of the ParseOrSemanticError
+ */
+struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new ParseError-variant ParseOrSemanticError
+ */
+struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseError a);
+
+/**
+ * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
+ */
+struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a);
+
/**
* Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
*/
*/
struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKStr description, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network);
+/**
+ * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
+ * See [`PhantomKeysManager`] for more information on phantom node payments.
+ *
+ * `phantom_route_hints` parameter:
+ * * Contains channel info for all nodes participating in the phantom invoice
+ * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
+ * participating node
+ * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
+ * updated when a channel becomes disabled or closes
+ * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
+ * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
+ * down
+ *
+ * `description_hash` is a SHA-256 hash of the description text
+ *
+ * `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or
+ * [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any
+ * participating node.
+ *
+ * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
+ * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
+ * requirement).
+ *
+ * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
+ * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
+ * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
+ */
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network);
+
/**
* Utility to construct an invoice. Generally, unless you want to do something like a custom
* cltv_expiry, this is what you should be using to create an invoice. The reason being, this
*/
struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description);
+/**
+ * Utility to construct an invoice. Generally, unless you want to do something like a custom
+ * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
+ * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
+ * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
+ * that the payment secret is valid when the invoice is paid.
+ * Use this variant if you want to pass the `description_hash` to the invoice.
+ */
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash);
+
+/**
+ * See [`create_invoice_from_channelmanager_with_description_hash`]
+ * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
+ * available and the current time is supplied by the caller.
+ */
+struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch);
+
/**
* See [`create_invoice_from_channelmanager`]
* This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
void DefaultRouter_free(struct LDKDefaultRouter this_obj);
/**
- * Creates a new router using the given [`NetworkGraph`] and [`Logger`].
+ * Creates a new router using the given [`NetworkGraph`], a [`Logger`], and a randomness source
+ * `random_seed_bytes`.
*/
-MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
+MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes);
/**
* Constructs a new Router which calls the relevant methods on this_arg.
/**
* Read a SiPrefix object from a string
*/
-struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
+struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s);
/**
* Read a Invoice object from a string
*/
-struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
+struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s);
/**
* Read a SignedRawInvoice object from a string
*/
-struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
+struct LDKCResult_SignedRawInvoiceParseErrorZ SignedRawInvoice_from_str(struct LDKStr s);
+
+/**
+ * Get the string representation of a ParseError object
+ */
+struct LDKStr ParseError_to_str(const struct LDKParseError *NONNULL_PTR o);
+
+/**
+ * Get the string representation of a ParseOrSemanticError object
+ */
+struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
/**
* Get the string representation of a Invoice object