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
19 changes: 19 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Pin syn and quote to meet MSRV
working-directory: lightning-c-bindings
run: |
cargo update -p syn --precise "2.0.106" --verbose
cargo update -p quote --precise "1.0.41" --verbose
- name: Sanity test bindings against Cargo.toml RL
working-directory: lightning-c-bindings
run: |
Expand All @@ -47,6 +52,8 @@ jobs:
git clone https://github.com/rust-bitcoin/rust-lightning
cd rust-lightning
git checkout 0.1-bindings
cargo update -p syn --precise "2.0.106" --verbose
cargo update -p quote --precise "1.0.41" --verbose
- 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
Expand Down Expand Up @@ -89,6 +96,11 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Pin syn and quote to meet MSRV
working-directory: lightning-c-bindings
run: |
cargo update -p syn --precise "2.0.106" --verbose
cargo update -p quote --precise "1.0.41" --verbose
- name: Sanity test bindings against Cargo.toml RL
working-directory: lightning-c-bindings
run: |
Expand All @@ -107,8 +119,15 @@ jobs:
git clone https://github.com/rust-bitcoin/rust-lightning
cd rust-lightning
git checkout 0.1-bindings
cargo update -p syn --precise "2.0.106" --verbose
cargo update -p quote --precise "1.0.41" --verbose
- 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
- 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
24 changes: 17 additions & 7 deletions lightning-c-bindings/include/lightning.h
Original file line number Diff line number Diff line change
Expand Up @@ -13500,7 +13500,7 @@ typedef struct LDKMessageRouter {
* [`get_event_or_persistence_needed_future`]: Self::get_event_or_persistence_needed_future
* [`lightning-block-sync`]: https://docs.rs/lightning_block_sync/latest/lightning_block_sync
* [`lightning-transaction-sync`]: https://docs.rs/lightning_transaction_sync/latest/lightning_transaction_sync
* [`lightning-background-processor`]: https://docs.rs/lightning_background_processor/lightning_background_processor
* [`lightning-background-processor`]: https://docs.rs/lightning-background-processor/latest/lightning_background_processor
* [`list_channels`]: Self::list_channels
* [`list_usable_channels`]: Self::list_usable_channels
* [`create_channel`]: Self::create_channel
Expand Down Expand Up @@ -20711,7 +20711,7 @@ typedef enum LDKEvent_Tag {
* To accept the request (and in the case of a dual-funded channel, not contribute funds),
* call [`ChannelManager::accept_inbound_channel`].
* To reject the request, call [`ChannelManager::force_close_without_broadcasting_txn`].
* Note that a ['ChannelClosed`] event will _not_ be triggered if the channel is rejected.
* Note that a [`ChannelClosed`] event will _not_ be triggered if the channel is rejected.
*
* 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.
Expand All @@ -20721,6 +20721,7 @@ typedef enum LDKEvent_Tag {
* returning `Err(ReplayEvent ())`) and won't be persisted across restarts.
*
* [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
* [`ChannelClosed`]: Event::ChannelClosed
* [`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
*/
Expand Down Expand Up @@ -42796,7 +42797,7 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const
*
* The `shutdown_script` provided will be used as the `scriptPubKey` for the closing transaction.
* Will fail if a shutdown script has already been set for this channel by
* ['ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must
* [`ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must
* also be compatible with our and the counterparty's features.
*
* May generate a [`SendShutdown`] message event on success, which should be relayed.
Expand All @@ -42808,6 +42809,7 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const
*
* [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
* [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
* [`ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]: crate::util::config::ChannelHandshakeConfig::commit_upfront_shutdown_pubkey
* [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
*
* Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None
Expand Down Expand Up @@ -43604,7 +43606,7 @@ MUST_USE_RES struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ ChannelManager_

/**
* Pays for an [`Offer`] looked up using [BIP 353] Human Readable Names resolved by the DNS
* resolver(s) at `dns_resolvers` which resolve names according to bLIP 32.
* resolver(s) at `dns_resolvers` which resolve names according to [bLIP 32].
*
* If the wallet supports paying on-chain schemes, you should instead use
* [`OMNameResolver::resolve_name`] and [`OMNameResolver::handle_dnssec_proof_for_uri`] (by
Expand All @@ -43622,27 +43624,33 @@ MUST_USE_RES struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ ChannelManager_
*
* To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the
* invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the
* payment will fail with an [`Event::InvoiceRequestFailed`].
* payment will fail with an [`PaymentFailureReason::UserAbandoned`] or
* [`PaymentFailureReason::InvoiceRequestExpired`], respectively.
*
* # Privacy
*
* For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`]
* to construct a [`BlindedPath`] for the reply path. For further privacy implications, see the
* to construct a [`BlindedMessagePath`] for the reply path. For further privacy implications, see the
* docs of the parameterized [`Router`], which implements [`MessageRouter`].
*
* # Limitations
*
* Requires a direct connection to the given [`Destination`] as well as an introduction node in
* [`Offer::paths`] or to [`Offer::signing_pubkey`], if empty. A similar restriction applies to
* [`Offer::paths`] or to [`Offer::issuer_signing_pubkey`], if empty. A similar restriction applies to
* the responding [`Bolt12Invoice::payment_paths`].
*
* # Errors
*
* Errors if:
* - a duplicate `payment_id` is provided given the caveats in the aforementioned link,
*
* [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
* [bLIP 32]: https://github.com/lightning/blips/blob/master/blip-0032.md
* [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths
* [Avoiding Duplicate Payments]: #avoiding-duplicate-payments
* [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath
* [`PaymentFailureReason::UserAbandoned`]: crate::events::PaymentFailureReason::UserAbandoned
* [`PaymentFailureReason::InvoiceRequestRejected`]: crate::events::PaymentFailureReason::InvoiceRequestRejected
*/
MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelManager_pay_for_offer_from_human_readable_name(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKHumanReadableName name, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat, struct LDKCVec_DestinationZ dns_resolvers);

Expand Down Expand Up @@ -50845,6 +50853,8 @@ MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const
* [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
* [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
* [`send_data`]: SocketDescriptor::send_data
* [`lightning-net-tokio`]: https://docs.rs/lightning-net-tokio/latest/lightning_net_tokio
* [`lightning-background-processor`]: https://docs.rs/lightning-background-processor/latest/lightning_background_processor
*/
void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);

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 @@ -2566,7 +2566,7 @@ pub enum Event {
/// To accept the request (and in the case of a dual-funded channel, not contribute funds),
/// call [`ChannelManager::accept_inbound_channel`].
/// To reject the request, call [`ChannelManager::force_close_without_broadcasting_txn`].
/// Note that a ['ChannelClosed`] event will _not_ be triggered if the channel is rejected.
/// Note that a [`ChannelClosed`] event will _not_ be triggered if the channel is rejected.
///
/// 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.
Expand All @@ -2576,6 +2576,7 @@ pub enum Event {
/// returning `Err(ReplayEvent ())`) and won't be persisted across restarts.
///
/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
/// [`ChannelClosed`]: Event::ChannelClosed
/// [`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
OpenChannelRequest {
Expand Down
19 changes: 13 additions & 6 deletions lightning-c-bindings/src/lightning/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1828,7 +1828,7 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport<crate::lightni
/// [`get_event_or_persistence_needed_future`]: Self::get_event_or_persistence_needed_future
/// [`lightning-block-sync`]: https://docs.rs/lightning_block_sync/latest/lightning_block_sync
/// [`lightning-transaction-sync`]: https://docs.rs/lightning_transaction_sync/latest/lightning_transaction_sync
/// [`lightning-background-processor`]: https://docs.rs/lightning_background_processor/lightning_background_processor
/// [`lightning-background-processor`]: https://docs.rs/lightning-background-processor/latest/lightning_background_processor
/// [`list_channels`]: Self::list_channels
/// [`list_usable_channels`]: Self::list_usable_channels
/// [`create_channel`]: Self::create_channel
Expand Down Expand Up @@ -2607,7 +2607,7 @@ pub extern "C" fn ChannelManager_close_channel(this_arg: &crate::lightning::ln::
///
/// The `shutdown_script` provided will be used as the `scriptPubKey` for the closing transaction.
/// Will fail if a shutdown script has already been set for this channel by
/// ['ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must
/// [`ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must
/// also be compatible with our and the counterparty's features.
///
/// May generate a [`SendShutdown`] message event on success, which should be relayed.
Expand All @@ -2619,6 +2619,7 @@ pub extern "C" fn ChannelManager_close_channel(this_arg: &crate::lightning::ln::
///
/// [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
/// [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
/// [`ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]: crate::util::config::ChannelHandshakeConfig::commit_upfront_shutdown_pubkey
/// [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
///
/// Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None
Expand Down Expand Up @@ -3622,7 +3623,7 @@ pub extern "C" fn ChannelManager_request_refund_payment(this_arg: &crate::lightn
}

/// Pays for an [`Offer`] looked up using [BIP 353] Human Readable Names resolved by the DNS
/// resolver(s) at `dns_resolvers` which resolve names according to bLIP 32.
/// resolver(s) at `dns_resolvers` which resolve names according to [bLIP 32].
///
/// If the wallet supports paying on-chain schemes, you should instead use
/// [`OMNameResolver::resolve_name`] and [`OMNameResolver::handle_dnssec_proof_for_uri`] (by
Expand All @@ -3640,27 +3641,33 @@ pub extern "C" fn ChannelManager_request_refund_payment(this_arg: &crate::lightn
///
/// To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the
/// invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the
/// payment will fail with an [`Event::InvoiceRequestFailed`].
/// payment will fail with an [`PaymentFailureReason::UserAbandoned`] or
/// [`PaymentFailureReason::InvoiceRequestExpired`], respectively.
///
/// # Privacy
///
/// For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`]
/// to construct a [`BlindedPath`] for the reply path. For further privacy implications, see the
/// to construct a [`BlindedMessagePath`] for the reply path. For further privacy implications, see the
/// docs of the parameterized [`Router`], which implements [`MessageRouter`].
///
/// # Limitations
///
/// Requires a direct connection to the given [`Destination`] as well as an introduction node in
/// [`Offer::paths`] or to [`Offer::signing_pubkey`], if empty. A similar restriction applies to
/// [`Offer::paths`] or to [`Offer::issuer_signing_pubkey`], if empty. A similar restriction applies to
/// the responding [`Bolt12Invoice::payment_paths`].
///
/// # Errors
///
/// Errors if:
/// - a duplicate `payment_id` is provided given the caveats in the aforementioned link,
///
/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
/// [bLIP 32]: https://github.com/lightning/blips/blob/master/blip-0032.md
/// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths
/// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments
/// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath
/// [`PaymentFailureReason::UserAbandoned`]: crate::events::PaymentFailureReason::UserAbandoned
/// [`PaymentFailureReason::InvoiceRequestRejected`]: crate::events::PaymentFailureReason::InvoiceRequestRejected
#[must_use]
#[no_mangle]
pub extern "C" fn ChannelManager_pay_for_offer_from_human_readable_name(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut name: crate::lightning::onion_message::dns_resolution::HumanReadableName, mut amount_msats: u64, mut payment_id: crate::c_types::ThirtyTwoBytes, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, mut max_total_routing_fee_msat: crate::c_types::derived::COption_u64Z, mut dns_resolvers: crate::c_types::derived::CVec_DestinationZ) -> crate::c_types::derived::CResult_NoneNoneZ {
Expand Down
2 changes: 2 additions & 0 deletions lightning-c-bindings/src/lightning/ln/peer_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,8 @@ pub extern "C" fn PeerManager_read_event(this_arg: &crate::lightning::ln::peer_h
/// [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
/// [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
/// [`send_data`]: SocketDescriptor::send_data
/// [`lightning-net-tokio`]: https://docs.rs/lightning-net-tokio/latest/lightning_net_tokio
/// [`lightning-background-processor`]: https://docs.rs/lightning-background-processor/latest/lightning_background_processor
#[no_mangle]
pub extern "C" fn PeerManager_process_events(this_arg: &crate::lightning::ln::peer_handler::PeerManager) {
unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.process_events()
Expand Down
Loading