Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
run: |
cargo update -p syn --precise "2.0.106" --verbose
cargo update -p quote --precise "1.0.41" --verbose
cargo update -p libc --precise 0.2.183 --verbose
cargo update -p serde_json --precise "1.0.145" --verbose
cargo update -p proc-macro2 --precise "1.0.103" --verbose
cargo update -p itoa --precise 1.0.15
cargo update -p unicode-ident --precise 1.0.22
cargo update -p ryu --precise "1.0.20"
- name: Sanity test bindings against Cargo.toml RL
working-directory: lightning-c-bindings
run: |
Expand All @@ -54,13 +60,20 @@ jobs:
git checkout 0.2-bindings
cargo update -p syn --precise "2.0.106" --verbose
cargo update -p quote --precise "1.0.41" --verbose
cargo update -p libc --precise 0.2.183 --verbose
cargo update -p serde_json --precise "1.0.145" --verbose
cargo update -p proc-macro2 --precise "1.0.103" --verbose
cargo update -p itoa --precise 1.0.15
cargo update -p unicode-ident --precise 1.0.22
cargo update -p ryu --precise "1.0.20"
- name: Fix Github Actions to not be broken
run: git config --global --add safe.directory /__w/ldk-c-bindings/ldk-c-bindings
- name: Pin proc-macro and quote to meet MSRV
run: |
cd c-bindings-gen
cargo update -p quote --precise "1.0.30" --verbose
cargo update -p proc-macro2 --precise "1.0.65" --verbose
cargo update -p unicode-ident --precise 1.0.22
- name: Rebuild bindings without std, and check the sample app builds + links
run: ./genbindings.sh ./rust-lightning false
- name: Rebuild bindings, and check the sample app builds + links
Expand Down Expand Up @@ -101,6 +114,12 @@ jobs:
run: |
cargo update -p syn --precise "2.0.106" --verbose
cargo update -p quote --precise "1.0.41" --verbose
cargo update -p libc --precise 0.2.183 --verbose
cargo update -p serde_json --precise "1.0.145" --verbose
cargo update -p proc-macro2 --precise "1.0.103" --verbose
cargo update -p itoa --precise 1.0.15
cargo update -p unicode-ident --precise 1.0.22
cargo update -p ryu --precise "1.0.20"
- name: Sanity test bindings against Cargo.toml RL
working-directory: lightning-c-bindings
run: |
Expand All @@ -121,13 +140,20 @@ jobs:
git checkout 0.2-bindings
cargo update -p syn --precise "2.0.106" --verbose
cargo update -p quote --precise "1.0.41" --verbose
cargo update -p libc --precise 0.2.183 --verbose
cargo update -p serde_json --precise "1.0.145" --verbose
cargo update -p proc-macro2 --precise "1.0.103" --verbose
cargo update -p itoa --precise 1.0.15
cargo update -p unicode-ident --precise 1.0.22
cargo update -p ryu --precise "1.0.20"
- name: Fix Github Actions to not be broken
run: git config --global --add safe.directory /__w/ldk-c-bindings/ldk-c-bindings
- name: Pin proc-macro and quote to meet MSRV
run: |
cd c-bindings-gen
cargo update -p quote --precise "1.0.30" --verbose
cargo update -p proc-macro2 --precise "1.0.65" --verbose
cargo update -p unicode-ident --precise 1.0.22
- name: Fetch MacOS SDK
run: |
wget https://bitcoincore.org/depends-sources/sdks/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
Expand Down
61 changes: 51 additions & 10 deletions lightning-c-bindings/include/lightning.h
Original file line number Diff line number Diff line change
Expand Up @@ -23726,7 +23726,8 @@ typedef struct LDKEvent_LDKPaymentSent_Body {
* If the recipient or an intermediate node misbehaves and gives us free money, this may
* overstate the amount paid, though this is unlikely.
*
* This is only `None` for payments initiated on LDK versions prior to 0.0.103.
* This is only `None` for payments abandoned but ultimately claimed when using LDK versions
* prior to 0.3, 0.2.3, or 0.1.10.
*
* [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
*/
Expand Down Expand Up @@ -32151,6 +32152,10 @@ extern const uintptr_t PAYER_NOTE_LIMIT;

extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;

extern const uintptr_t CHAN_COUNT_ESTIMATE;

extern const uintptr_t NODE_COUNT_ESTIMATE;

extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;

extern const uint8_t DEFAULT_MAX_PATH_COUNT;
Expand Down Expand Up @@ -51967,6 +51972,12 @@ void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struc
* the channel. This will spend the channel's funding transaction output, effectively replacing
* it with a new one.
*
* # Required Feature Flags
*
* Initiating a splice requires that the channel counterparty supports splicing. Any
* channel (no matter the type) can be spliced, as long as the counterparty is currently
* connected.
*
* # Arguments
*
* Provide a `contribution` to determine if value is spliced in or out. The splice initiator is
Expand Down Expand Up @@ -61492,7 +61503,7 @@ MUST_USE_RES struct LDKCResult_NoneNoneZ OffersMessageFlow_set_paths_to_static_i
* Must be called whenever a new chain tip becomes available. May be skipped
* for intermediary blocks.
*/
void OffersMessageFlow_best_block_updated(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t _height);
void OffersMessageFlow_best_block_updated(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height);

/**
* [`BlindedMessagePath`]s for an async recipient to communicate with this node and interactively
Expand Down Expand Up @@ -71755,12 +71766,12 @@ void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR thi
/**
* Unsets this feature.
*/
void InitFeatures_supports_zero_conf(struct LDKInitFeatures *NONNULL_PTR this_arg);
void InitFeatures_clear_zero_conf(struct LDKInitFeatures *NONNULL_PTR this_arg);

/**
* Checks if this feature is supported.
*/
MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);

/**
* Set this feature as optional.
Expand All @@ -71775,12 +71786,12 @@ void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR thi
/**
* Unsets this feature.
*/
void NodeFeatures_supports_zero_conf(struct LDKNodeFeatures *NONNULL_PTR this_arg);
void NodeFeatures_clear_zero_conf(struct LDKNodeFeatures *NONNULL_PTR this_arg);

/**
* Checks if this feature is supported.
*/
MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);

/**
* Set this feature as optional.
Expand All @@ -71795,11 +71806,26 @@ void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *N
/**
* Unsets this feature.
*/
void ChannelTypeFeatures_supports_zero_conf(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
void ChannelTypeFeatures_clear_zero_conf(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);

/**
* Checks if this feature is supported.
*/
MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);

/**
* Checks if this feature is required.
*/
MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);

/**
* Checks if this feature is required.
*/
MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);

/**
* Checks if this feature is required.
*/
MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);

/**
Expand Down Expand Up @@ -73305,13 +73331,16 @@ MUST_USE_RES struct LDKCOption_CVec_u8ZZ Bolt11Invoice_payment_metadata(const st
MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11Invoice_features(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);

/**
* Recover the payee's public key (only to be used if none was included in the invoice)
* Get the invoice's payee public key.
*
* This uses the explicitly included payee public key, if present, otherwise it recovers the
* payee public key from the signature. Prefer [`Self::get_payee_pub_key`] for clarity.
*/
MUST_USE_RES struct LDKPublicKey Bolt11Invoice_recover_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);

/**
* Recover the payee's public key if one was included in the invoice, otherwise return the
* recovered public key from the signature
* Get the invoice's payee public key, preferring an explicitly included payee public key and
* falling back to recovering the key from the signature.
*/
MUST_USE_RES struct LDKPublicKey Bolt11Invoice_get_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg);

Expand Down Expand Up @@ -73711,6 +73740,10 @@ MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetwo
* Sync gossip data from a file.
* Returns the last sync timestamp to be used the next time rapid sync data is queried.
*
* You should consider the gossip data source as semi-trusted. It is generally the case that it
* can DoS the client either by omitting data which leads to pathfinding failure or by bloating
* the graph such that it leads to eventual OOM on the client.
*
* `network_graph`: The network graph to apply the updates to
*
* `sync_path`: Path to the file where the gossip update data is located
Expand All @@ -73722,6 +73755,10 @@ MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_sync_network_g
* Update network graph from binary data.
* Returns the last sync timestamp to be used the next time rapid sync data is queried.
*
* You should consider the gossip data source as semi-trusted. It is generally the case that it
* can DoS the client either by omitting data which leads to pathfinding failure or by bloating
* the graph such that it leads to eventual OOM on the client.
*
* `update_data`: `&[u8]` binary stream that comprises the update data
*/
MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data);
Expand All @@ -73730,6 +73767,10 @@ MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network
* Update network graph from binary data.
* Returns the last sync timestamp to be used the next time rapid sync data is queried.
*
* You should consider the gossip data source as semi-trusted. It is generally the case that it
* can DoS the client either by omitting data which leads to pathfinding failure or by bloating
* the graph such that it leads to eventual OOM on the client.
*
* `update_data`: `&[u8]` binary stream that comprises the update data
* `current_time_unix`: `Option<u64>` optional current timestamp to verify data age
*/
Expand Down
3 changes: 2 additions & 1 deletion lightning-c-bindings/src/lightning/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2343,7 +2343,8 @@ pub enum Event {
/// If the recipient or an intermediate node misbehaves and gives us free money, this may
/// overstate the amount paid, though this is unlikely.
///
/// This is only `None` for payments initiated on LDK versions prior to 0.0.103.
/// This is only `None` for payments abandoned but ultimately claimed when using LDK versions
/// prior to 0.3, 0.2.3, or 0.1.10.
///
/// [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
fee_paid_msat: crate::c_types::derived::COption_u64Z,
Expand Down
6 changes: 6 additions & 0 deletions lightning-c-bindings/src/lightning/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2936,6 +2936,12 @@ pub extern "C" fn ChannelManager_force_close_all_channels_broadcasting_latest_tx
/// the channel. This will spend the channel's funding transaction output, effectively replacing
/// it with a new one.
///
/// # Required Feature Flags
///
/// Initiating a splice requires that the channel counterparty supports splicing. Any
/// channel (no matter the type) can be spliced, as long as the counterparty is currently
/// connected.
///
/// # Arguments
///
/// Provide a `contribution` to determine if value is spliced in or out. The splice initiator is
Expand Down
4 changes: 2 additions & 2 deletions lightning-c-bindings/src/lightning/offers/flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ pub extern "C" fn OffersMessageFlow_set_paths_to_static_invoice_server(this_arg:
/// Must be called whenever a new chain tip becomes available. May be skipped
/// for intermediary blocks.
#[no_mangle]
pub extern "C" fn OffersMessageFlow_best_block_updated(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, header: *const [u8; 80], mut _height: u32) {
unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.best_block_updated(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), _height)
pub extern "C" fn OffersMessageFlow_best_block_updated(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, header: *const [u8; 80], mut height: u32) {
unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.best_block_updated(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height)
}

/// The maximum size of a received [`StaticInvoice`] before we'll fail verification in
Expand Down
14 changes: 14 additions & 0 deletions lightning-c-bindings/src/lightning/routing/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2262,6 +2262,20 @@ pub extern "C" fn NetworkGraph_read(ser: crate::c_types::u8slice, arg: crate::li
pub extern "C" fn NetworkGraph_to_str(o: &crate::lightning::routing::gossip::NetworkGraph) -> Str {
alloc::format!("{}", o.get_native_ref()).into()
}
/// In Jan, 2025 there were about 49K channels.
///
/// We over-allocate by a bit because 20% more is better than the double we get if we're slightly
/// too low

#[no_mangle]
pub static CHAN_COUNT_ESTIMATE: usize = lightning::routing::gossip::CHAN_COUNT_ESTIMATE;
/// In Jan, 2025 there were about 15K nodes
///
/// We over-allocate by a bit because 33% more is better than the double we get if we're slightly
/// too low

#[no_mangle]
pub static NODE_COUNT_ESTIMATE: usize = lightning::routing::gossip::NODE_COUNT_ESTIMATE;
/// Creates a new, empty, network graph.
#[must_use]
#[no_mangle]
Expand Down
9 changes: 6 additions & 3 deletions lightning-c-bindings/src/lightning_invoice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2631,16 +2631,19 @@ pub extern "C" fn Bolt11Invoice_features(this_arg: &crate::lightning_invoice::Bo
local_ret
}

/// Recover the payee's public key (only to be used if none was included in the invoice)
/// Get the invoice's payee public key.
///
/// This uses the explicitly included payee public key, if present, otherwise it recovers the
/// payee public key from the signature. Prefer [`Self::get_payee_pub_key`] for clarity.
#[must_use]
#[no_mangle]
pub extern "C" fn Bolt11Invoice_recover_payee_pub_key(this_arg: &crate::lightning_invoice::Bolt11Invoice) -> crate::c_types::PublicKey {
let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.recover_payee_pub_key();
crate::c_types::PublicKey::from_rust(&ret)
}

/// Recover the payee's public key if one was included in the invoice, otherwise return the
/// recovered public key from the signature
/// Get the invoice's payee public key, preferring an explicitly included payee public key and
/// falling back to recovering the key from the signature.
#[must_use]
#[no_mangle]
pub extern "C" fn Bolt11Invoice_get_payee_pub_key(this_arg: &crate::lightning_invoice::Bolt11Invoice) -> crate::c_types::PublicKey {
Expand Down
12 changes: 12 additions & 0 deletions lightning-c-bindings/src/lightning_rapid_gossip_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ pub extern "C" fn RapidGossipSync_new(network_graph: &crate::lightning::routing:
/// Sync gossip data from a file.
/// Returns the last sync timestamp to be used the next time rapid sync data is queried.
///
/// You should consider the gossip data source as semi-trusted. It is generally the case that it
/// can DoS the client either by omitting data which leads to pathfinding failure or by bloating
/// the graph such that it leads to eventual OOM on the client.
///
/// `network_graph`: The network graph to apply the updates to
///
/// `sync_path`: Path to the file where the gossip update data is located
Expand All @@ -307,6 +311,10 @@ pub extern "C" fn RapidGossipSync_sync_network_graph_with_file_path(this_arg: &c
/// Update network graph from binary data.
/// Returns the last sync timestamp to be used the next time rapid sync data is queried.
///
/// You should consider the gossip data source as semi-trusted. It is generally the case that it
/// can DoS the client either by omitting data which leads to pathfinding failure or by bloating
/// the graph such that it leads to eventual OOM on the client.
///
/// `update_data`: `&[u8]` binary stream that comprises the update data
#[must_use]
#[no_mangle]
Expand All @@ -319,6 +327,10 @@ pub extern "C" fn RapidGossipSync_update_network_graph(this_arg: &crate::lightni
/// Update network graph from binary data.
/// Returns the last sync timestamp to be used the next time rapid sync data is queried.
///
/// You should consider the gossip data source as semi-trusted. It is generally the case that it
/// can DoS the client either by omitting data which leads to pathfinding failure or by bloating
/// the graph such that it leads to eventual OOM on the client.
///
/// `update_data`: `&[u8]` binary stream that comprises the update data
/// `current_time_unix`: `Option<u64>` optional current timestamp to verify data age
#[must_use]
Expand Down
Loading
Loading