X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=lightning-c-bindings%2Finclude%2Flightning.h;fp=lightning-c-bindings%2Finclude%2Flightning.h;h=113624298d2b7d464f57213da9827a7c8cc3d21f;hp=c1538b8d1f2eb7ded7d9eae47843ff9f9a1fec97;hb=1c42b239702f5435607e605fca91fe0f945afecf;hpb=5768b0ee36e3d4263162be17b24f21059c688a9c diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index c1538b8..1136242 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -1,7 +1,7 @@ #ifndef LDK_C_BINDINGS_H #define LDK_C_BINDINGS_H -/* Generated with cbindgen:0.20.0 */ +/* Generated with cbindgen:0.24.3 */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ @@ -2790,13 +2790,13 @@ typedef enum LDKEvent_Tag { * Indicates a request to open a new channel by a peer. * * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the - * request, call [`ChannelManager::force_close_channel`]. + * request, call [`ChannelManager::force_close_without_broadcasting_txn`]. * * The event is only triggered when a new open channel request is received and the * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. * * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel + * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ LDKEvent_OpenChannelRequest, @@ -3130,10 +3130,10 @@ typedef struct LDKEvent_LDKOpenChannelRequest_Body { * * When responding to the request, the `temporary_channel_id` should be passed * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept, - * or through [`ChannelManager::force_close_channel`] to reject. + * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject. * * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel + * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn */ struct LDKThirtyTwoBytes temporary_channel_id; /** @@ -3141,11 +3141,11 @@ typedef struct LDKEvent_LDKOpenChannelRequest_Body { * * When responding to the request, the `counterparty_node_id` should be passed * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to - * accept the request, or through [`ChannelManager::force_close_channel`] to reject the + * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the * request. * * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel + * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn */ struct LDKPublicKey counterparty_node_id; /** @@ -4415,6 +4415,83 @@ typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ { bool result_ok; } LDKCResult_FixedPenaltyScorerDecodeErrorZ; +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_u64u64Z { + /** + * The element at position 0 + */ + uint64_t a; + /** + * The element at position 1 + */ + uint64_t b; +} LDKC2Tuple_u64u64Z; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not + */ +typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z + */ + LDKCOption_C2Tuple_u64u64ZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing + */ + LDKCOption_C2Tuple_u64u64ZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_u64u64ZZ_Sentinel, +} LDKCOption_C2Tuple_u64u64ZZ_Tag; + +typedef struct LDKCOption_C2Tuple_u64u64ZZ { + LDKCOption_C2Tuple_u64u64ZZ_Tag tag; + union { + struct { + struct LDKC2Tuple_u64u64Z some; + }; + }; +} LDKCOption_C2Tuple_u64u64ZZ; + + + +/** + * Represents the compressed public key of a node + */ +typedef struct MUST_USE_STRUCT LDKNodeId { + /** + * 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. + */ + LDKnativeNodeId *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; +} LDKNodeId; + +/** + * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_NodeIdZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKNodeId *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_NodeIdZ; + /** @@ -4795,26 +4872,6 @@ typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ { bool result_ok; } LDKCResult_ChannelTypeFeaturesDecodeErrorZ; - - -/** - * Represents the compressed public key of a node - */ -typedef struct MUST_USE_STRUCT LDKNodeId { - /** - * 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. - */ - LDKnativeNodeId *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; -} LDKNodeId; - /** * The contents of CResult_NodeIdDecodeErrorZ */ @@ -5391,6 +5448,62 @@ typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ { bool result_ok; } LDKCResult_NodeAnnouncementInfoDecodeErrorZ; + + +/** + * A user-defined name for a node, which may be used when displaying the node in a graph. + * + * Since node aliases are provided by third parties, they are a potential avenue for injection + * attacks. Care must be taken when processing. + */ +typedef struct MUST_USE_STRUCT LDKNodeAlias { + /** + * 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. + */ + LDKnativeNodeAlias *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; +} LDKNodeAlias; + +/** + * The contents of CResult_NodeAliasDecodeErrorZ + */ +typedef union LDKCResult_NodeAliasDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKNodeAlias *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_NodeAliasDecodeErrorZPtr; + +/** + * A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::gossip::NodeAlias 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_NodeAliasDecodeErrorZ { + /** + * The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NodeAliasDecodeErrorZPtr contents; + /** + * Whether this CResult_NodeAliasDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_NodeAliasDecodeErrorZ; + /** * A dynamically-allocated array of u64s of arbitrary size. * This corresponds to std::vector in C++ @@ -6845,6 +6958,22 @@ typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { bool result_ok; } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ; +/** + * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_ThirtyTwoBytesZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKThirtyTwoBytes *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_ThirtyTwoBytesZ; + /** * A tuple of 2 elements. See the individual fields for the types contained. */ @@ -7369,7 +7498,9 @@ typedef struct LDKKeysInterface { */ void *this_arg; /** - * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`]. + * Get node secret key based on the provided [`Recipient`]. + * + * The node_id/network_key is the public key that corresponds to this secret key. * * This method must return the same value each time it is called with a given `Recipient` * parameter. @@ -12216,6 +12347,10 @@ typedef struct LDKEffectiveCapacity_LDKTotal_Body { * The funding amount denominated in millisatoshi. */ uint64_t capacity_msat; + /** + * The maximum HTLC amount denominated in millisatoshi. + */ + struct LDKCOption_u64Z htlc_maximum_msat; } LDKEffectiveCapacity_LDKTotal_Body; typedef struct MUST_USE_STRUCT LDKEffectiveCapacity { @@ -12700,6 +12835,8 @@ extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT; extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA; +extern const uint8_t DEFAULT_MAX_MPP_PATH_COUNT; + extern const uint64_t MAX_TIMESTAMP; extern const uint64_t DEFAULT_EXPIRY_TIME; @@ -13831,6 +13968,48 @@ void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyS */ struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_u64u64Z from the contained elements. + */ +struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); + +/** + * Frees any resources used by the C2Tuple_u64u64Z. + */ +void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res); + +/** + * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z + */ +struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o); + +/** + * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing + */ +struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state + */ +void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res); + +/** + * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res); + /** * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. */ @@ -14235,6 +14414,32 @@ void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnounc */ struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_NodeAliasDecodeErrorZ in the success state. + */ +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o); + +/** + * Creates a new CResult_NodeAliasDecodeErrorZ in the error state. + */ +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NodeAliasDecodeErrorZ. + */ +void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res); + +/** + * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig); + /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -14888,6 +15093,11 @@ void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCRe */ struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res); + /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. @@ -17569,20 +17779,20 @@ void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_chan * * 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`]. + * [`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 + * [`ChannelHandshakeConfig::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 + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue */ bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); @@ -17594,27 +17804,87 @@ bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHa * * 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`]. + * [`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 + * [`ChannelHandshakeConfig::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 + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue */ void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); +/** + * Set to announce the channel publicly and notify all nodes that they can route via this + * channel. + * + * This should only be set to true for nodes which expect to be online reliably. + * + * As the node which funds a channel picks this value this will only apply for new outbound + * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. + * + * Default value: false. + */ +bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); + +/** + * Set to announce the channel publicly and notify all nodes that they can route via this + * channel. + * + * This should only be set to true for nodes which expect to be online reliably. + * + * As the node which funds a channel picks this value this will only apply for new outbound + * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. + * + * Default value: false. + */ +void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); + +/** + * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty + * supports it, they will then enforce the mutual-close output to us matches what we provided + * at intialization, preventing us from closing to an alternate pubkey. + * + * This is set to true by default to provide a slight increase in security, though ultimately + * any attacker who is able to take control of a channel can just as easily send the funds via + * lightning payments, so we never require that our counterparties support this option. + * + * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`]. + * + * Default value: true. + * + * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + */ +bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); + +/** + * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty + * supports it, they will then enforce the mutual-close output to us matches what we provided + * at intialization, preventing us from closing to an alternate pubkey. + * + * This is set to true by default to provide a slight increase in security, though ultimately + * any attacker who is able to take control of a channel can just as easily send the funds via + * lightning payments, so we never require that our counterparties support this option. + * + * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`]. + * + * Default value: true. + * + * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + */ +void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(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, uint8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, bool negotiate_scid_privacy_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, uint8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, bool negotiate_scid_privacy_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg); /** * Creates a copy of the ChannelHandshakeConfig @@ -17793,10 +18063,10 @@ void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandsha /** * Set to force an incoming channel to match our announced channel preference in - * [`ChannelConfig::announced_channel`]. + * [`ChannelHandshakeConfig::announced_channel`]. * * For a node which is not online reliably, this should be set to true and - * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public) + * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public) * channels will ever be opened. * * Default value: true. @@ -17805,10 +18075,10 @@ bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct /** * Set to force an incoming channel to match our announced channel preference in - * [`ChannelConfig::announced_channel`]. + * [`ChannelHandshakeConfig::announced_channel`]. * * For a node which is not online reliably, this should be set to true and - * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public) + * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public) * channels will ever be opened. * * Default value: true. @@ -17955,66 +18225,6 @@ uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONN */ void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val); -/** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * This should only be set to true for nodes which expect to be online reliably. - * - * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. - * - * This cannot be changed after the initial channel handshake. - * - * Default value: false. - */ -bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr); - -/** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * This should only be set to true for nodes which expect to be online reliably. - * - * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. - * - * This cannot be changed after the initial channel handshake. - * - * Default value: false. - */ -void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); - -/** - * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty - * supports it, they will then enforce the mutual-close output to us matches what we provided - * at intialization, preventing us from closing to an alternate pubkey. - * - * This is set to true by default to provide a slight increase in security, though ultimately - * any attacker who is able to take control of a channel can just as easily send the funds via - * lightning payments, so we never require that our counterparties support this option. - * - * This cannot be changed after a channel has been initialized. - * - * Default value: true. - */ -bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr); - -/** - * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty - * supports it, they will then enforce the mutual-close output to us matches what we provided - * at intialization, preventing us from closing to an alternate pubkey. - * - * This is set to true by default to provide a slight increase in security, though ultimately - * any attacker who is able to take control of a channel can just as easily send the funds via - * lightning payments, so we never require that our counterparties support this option. - * - * This cannot be changed after a channel has been initialized. - * - * Default value: true. - */ -void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); - /** * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too * small to claim on-chain. @@ -18108,7 +18318,7 @@ void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelC /** * Constructs a new ChannelConfig given each field */ -MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg); +MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg); /** * Creates a copy of the ChannelConfig @@ -18136,34 +18346,34 @@ struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice void UserConfig_free(struct LDKUserConfig this_obj); /** - * Channel config that we propose to our counterparty. + * Channel handshake config that we propose to our counterparty. */ -struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Channel config that we propose to our counterparty. + * Channel handshake config that we propose to our counterparty. */ -void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); +void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); /** - * Limits applied to our counterparty's proposed channel config settings. + * Limits applied to our counterparty's proposed channel handshake config settings. */ -struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Limits applied to our counterparty's proposed channel config settings. + * Limits applied to our counterparty's proposed channel handshake config settings. */ -void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); +void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); /** * Channel config which affects behavior during channel lifetime. */ -struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** * Channel config which affects behavior during channel lifetime. */ -void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); +void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); /** * If this is set to false, we will reject any HTLCs which were to be forwarded over private @@ -18171,7 +18381,7 @@ void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, * node which is not online reliably. * * For nodes which are not online reliably, you should set all channels to *not* be announced - * (using [`ChannelConfig::announced_channel`] and + * (using [`ChannelHandshakeConfig::announced_channel`] and * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to * ensure you are not exposed to any forwarding risk. * @@ -18191,7 +18401,7 @@ bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig * node which is not online reliably. * * For nodes which are not online reliably, you should set all channels to *not* be announced - * (using [`ChannelConfig::announced_channel`] and + * (using [`ChannelHandshakeConfig::announced_channel`] and * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to * ensure you are not exposed to any forwarding risk. * @@ -18254,7 +18464,7 @@ void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNU /** * Constructs a new UserConfig given each field */ -MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg); +MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig channel_handshake_config_arg, struct LDKChannelHandshakeLimits channel_handshake_limits_arg, struct LDKChannelConfig channel_config_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg); /** * Creates a copy of the UserConfig @@ -20052,10 +20262,28 @@ struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct */ void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +/** + * Set of configurable parameters that affect channel operation. + * + * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * Set of configurable parameters that affect channel operation. + * + * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val); + /** * 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 LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_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 next_outbound_htlc_limit_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_channel_ready_arg, bool is_usable_arg, bool is_public_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_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 outbound_scid_alias_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 next_outbound_htlc_limit_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_channel_ready_arg, bool is_usable_arg, bool is_public_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg); /** * Creates a copy of the ChannelDetails @@ -20273,18 +20501,34 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id, uint32_t target_feerate_sats_per_1000_weight); /** - * Force closes a channel, immediately broadcasting the latest local commitment transaction to - * the chain and rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to + * Force closes a channel, immediately broadcasting the latest local transaction(s) and + * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding * channel. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id); + +/** + * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting + * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the + * `counterparty_node_id` isn't the counterparty of the corresponding channel. + * + * You can always get the latest local transaction(s) to broadcast from + * [`ChannelMonitor::get_latest_holder_commitment_txn`]. + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id); /** * Force close all channels, immediately broadcasting the latest local commitment transaction * for each to the chain and rejecting new HTLCs on each. */ -void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Force close all channels rejecting new HTLCs on each but without broadcasting the latest + * local transaction(s). + */ +void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Sends a payment along a given route. @@ -20389,6 +20633,9 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`]. * + * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation + * across the p2p network. + * * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`]. * @@ -20404,6 +20651,11 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ * not currently support replacing a funding transaction on an existing channel. Instead, * create a new channel with a conflicting funding transaction. * + * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend + * the wallet software generating the funding transaction to apply anti-fee sniping as + * implemented by Bitcoin Core wallet. See + * for more details. + * * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed */ @@ -20431,6 +20683,32 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_ */ void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses); +/** + * Atomically updates the [`ChannelConfig`] for the given channels. + * + * Once the updates are applied, each eligible channel (advertised with a known short channel + * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`], + * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated + * containing the new [`ChannelUpdate`] message which should be broadcast to the network. + * + * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect + * `counterparty_node_id` is provided. + * + * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value + * below [`MIN_CLTV_EXPIRY_DELTA`]. + * + * If an error is returned, none of the updates should be considered applied. + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat + * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta + * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`ChannelUnavailable`]: APIError::ChannelUnavailable + * [`APIMisuseError`]: APIError::APIMisuseError + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ThirtyTwoBytesZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config); + /** * Processes HTLCs which are pending waiting on random forward delay. * @@ -20447,6 +20725,8 @@ void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager * * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more * than a minute, informing the network that they should no longer attempt to route over * the channel. + * * Expiring a channel's previous `ChannelConfig` if necessary to only allow forwarding HTLCs + * with the current `ChannelConfig`. * * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate * estimate fetches. @@ -25915,7 +26195,7 @@ struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat) /** * Utility method to constructs a new Total-variant EffectiveCapacity */ -struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat); +struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, struct LDKCOption_u64Z htlc_maximum_msat); /** * Utility method to constructs a new Infinite-variant EffectiveCapacity @@ -26033,14 +26313,14 @@ void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR th * May be invalid or malicious (eg control chars), * should not be exposed to the user. */ -const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32]; +struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** * Moniker assigned to the node. * May be invalid or malicious (eg control chars), * should not be exposed to the user. */ -void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val); /** * Internet-level addresses via which one can connect to the node @@ -26070,7 +26350,7 @@ void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInf /** * Constructs a new NodeAnnouncementInfo given each field */ -MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg); +MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg); /** * Creates a copy of the NodeAnnouncementInfo @@ -26087,6 +26367,35 @@ struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementIn */ struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); +/** + * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL. + */ +void NodeAlias_free(struct LDKNodeAlias this_obj); + +const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32]; + +void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Constructs a new NodeAlias given each field + */ +MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg); + +/** + * Creates a copy of the NodeAlias + */ +struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig); + +/** + * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read + */ +struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj); + +/** + * Read a NodeAlias from a byte array, created by NodeAlias_write + */ +struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser); + /** * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL. */ @@ -26622,18 +26931,32 @@ void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR /** * The maximum total CLTV delta we accept for the route. + * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. */ uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** * The maximum total CLTV delta we accept for the route. + * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. */ void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val); +/** + * The maximum number of paths that may be used by MPP payments. + * Defaults to [`DEFAULT_MAX_MPP_PATH_COUNT`]. + */ +uint8_t PaymentParameters_get_max_mpp_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + +/** + * The maximum number of paths that may be used by MPP payments. + * Defaults to [`DEFAULT_MAX_MPP_PATH_COUNT`]. + */ +void PaymentParameters_set_max_mpp_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); + /** * Constructs a new PaymentParameters given each field */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPublicKey payee_pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPublicKey payee_pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_mpp_path_count_arg); /** * Creates a copy of the PaymentParameters @@ -27091,9 +27414,24 @@ uint64_t ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(const void ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new ProbabilisticScoringParameters given each field + * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the + * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We + * treat such nodes preferentially as this makes balance discovery attacks harder to execute, + * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy. + * + * Default value: 250 msat */ -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); +uint64_t ProbabilisticScoringParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); + +/** + * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the + * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We + * treat such nodes preferentially as this makes balance discovery attacks harder to execute, + * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy. + * + * Default value: 250 msat + */ +void ProbabilisticScoringParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** * Creates a copy of the ProbabilisticScoringParameters @@ -27114,6 +27452,34 @@ MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKPro */ void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); +/** + * Query the estimated minimum and maximum liquidity available for sending a payment over the + * channel with `scid` towards the given `target` node. + */ +MUST_USE_RES struct LDKCOption_C2Tuple_u64u64ZZ ProbabilisticScorer_estimated_channel_liquidity_range(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target); + +/** + * Marks the node with the given `node_id` as banned, i.e., + * it will be avoided during path finding. + */ +void ProbabilisticScorer_add_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); + +/** + * Removes the node with the given `node_id` from the list of nodes to avoid. + */ +void ProbabilisticScorer_remove_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); + +/** + * Clears the list of nodes that are avoided during path finding. + */ +void ProbabilisticScorer_clear_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg); + +/** + * Marks all nodes in the given list as banned, i.e., + * they will be avoided during path finding. + */ +void ProbabilisticScoringParameters_add_banned_from_list(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids); + /** * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used. */ @@ -27213,7 +27579,7 @@ struct LDKGossipSync GossipSync_none(void); * * # Rapid Gossip Sync * - * If rapid gossip sync is meant to run at startup, pass a [`RapidGossipSync`] to `gossip_sync` + * If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync` * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance * until the [`RapidGossipSync`] instance completes its first sync. *