Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions lightning/src/chain/chainmonitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ impl<ChannelSigner: EcdsaChannelSigner> Deref for LockedChannelMonitor<'_, Chann

/// An unconstructable [`Persist`]er which is used under the hood when you call
/// [`ChainMonitor::new_async_beta`].
///
/// This is not exported to bindings users as async is not supported outside of Rust.
pub struct AsyncPersister<
K: Deref + MaybeSend + MaybeSync + 'static,
S: FutureSpawner,
Expand Down Expand Up @@ -431,6 +433,8 @@ impl<
/// [`MonitorUpdatingPersisterAsync`] and thus allows persistence to be completed async.
///
/// Note that async monitor updating is considered beta, and bugs may be triggered by its use.
///
/// This is not exported to bindings users as async is not supported outside of Rust.
pub fn new_async_beta(
chain_source: Option<C>, broadcaster: T, logger: L, feeest: F,
persister: MonitorUpdatingPersisterAsync<K, S, L, ES, SP, T, F>, _entropy_source: ES,
Expand Down
8 changes: 8 additions & 0 deletions lightning/src/events/bump_transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ pub struct CoinSelection {
/// which can provide a default implementation of this trait when used with [`Wallet`].
///
/// For a synchronous version of this trait, see [`sync::CoinSelectionSourceSync`].
///
/// This is not exported to bindings users as async is only supported in Rust.
pub trait CoinSelectionSource {
/// Performs coin selection of a set of UTXOs, with at least 1 confirmation each, that are
/// available to spend. Implementations are free to pick their coin selection algorithm of
Expand Down Expand Up @@ -404,6 +406,8 @@ pub trait CoinSelectionSource {
/// provide a default implementation to [`CoinSelectionSource`].
///
/// For a synchronous version of this trait, see [`sync::WalletSourceSync`].
///
/// This is not exported to bindings users as async is only supported in Rust.
pub trait WalletSource {
/// Returns all UTXOs, with at least 1 confirmation each, that are available to spend.
fn list_confirmed_utxos<'a>(&'a self) -> AsyncResult<'a, Vec<Utxo>, ()>;
Expand All @@ -424,6 +428,8 @@ pub trait WalletSource {
/// spends may happen.
///
/// For a synchronous version of this wrapper, see [`sync::WalletSync`].
///
/// This is not exported to bindings users as async is only supported in Rust.
pub struct Wallet<W: Deref + MaybeSync + MaybeSend, L: Deref + MaybeSync + MaybeSend>
where
W::Target: WalletSource + MaybeSend,
Expand Down Expand Up @@ -670,6 +676,8 @@ where
///
/// For a synchronous version of this handler, see [`sync::BumpTransactionEventHandlerSync`].
///
/// This is not exported to bindings users as async is only supported in Rust.
///
/// [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction
pub struct BumpTransactionEventHandler<B: Deref, C: Deref, SP: Deref, L: Deref>
where
Expand Down
2 changes: 2 additions & 0 deletions lightning/src/sign/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,8 @@ pub trait SignerProvider {

/// A helper trait that describes an on-chain wallet capable of returning a (change) destination
/// script.
///
/// This is not exported to bindings users as async is only supported in Rust.
pub trait ChangeDestinationSource {
/// Returns a script pubkey which can be used as a change destination for
/// [`OutputSpender::spend_spendable_outputs`].
Expand Down
12 changes: 12 additions & 0 deletions lightning/src/util/async_poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,39 @@ pub(crate) fn dummy_waker() -> Waker {

#[cfg(feature = "std")]
/// A type alias for a future that returns a result of type `T` or error `E`.
///
/// This is not exported to bindings users as async is only supported in Rust.
pub type AsyncResult<'a, T, E> = Pin<Box<dyn Future<Output = Result<T, E>> + 'a + Send>>;
#[cfg(not(feature = "std"))]
/// A type alias for a future that returns a result of type `T` or error `E`.
///
/// This is not exported to bindings users as async is only supported in Rust.
pub type AsyncResult<'a, T, E> = Pin<Box<dyn Future<Output = Result<T, E>> + 'a>>;

/// Marker trait to optionally implement `Sync` under std.
///
/// This is not exported to bindings users as async is only supported in Rust.
#[cfg(feature = "std")]
pub use core::marker::Sync as MaybeSync;

#[cfg(not(feature = "std"))]
/// Marker trait to optionally implement `Sync` under std.
///
/// This is not exported to bindings users as async is only supported in Rust.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope: some of the Maybe* markers were needed for rust 1.63. With the MSRV bump, perhaps some clean up is possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, yea, would be good to go back and remove what we can now.

Copy link
Contributor

@joostjager joostjager Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIssing the hypothetical rust 'unnecessary bound' warning.

pub trait MaybeSync {}
#[cfg(not(feature = "std"))]
impl<T> MaybeSync for T where T: ?Sized {}

/// Marker trait to optionally implement `Send` under std.
///
/// This is not exported to bindings users as async is only supported in Rust.
#[cfg(feature = "std")]
pub use core::marker::Send as MaybeSend;

#[cfg(not(feature = "std"))]
/// Marker trait to optionally implement `Send` under std.
///
/// This is not exported to bindings users as async is only supported in Rust.
pub trait MaybeSend {}
#[cfg(not(feature = "std"))]
impl<T> MaybeSend for T where T: ?Sized {}
2 changes: 2 additions & 0 deletions lightning/src/util/native_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ use core::future::Future;
use core::pin::Pin;

/// A generic trait which is able to spawn futures in the background.
///
/// This is not exported to bindings users as async is only supported in Rust.
pub trait FutureSpawner: MaybeSend + MaybeSync + 'static {
/// Spawns the given future as a background task.
///
Expand Down
5 changes: 5 additions & 0 deletions lightning/src/util/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ where
}
}

/// This is not exported to bindings users as async is only supported in Rust.
impl<K: Deref> KVStore for KVStoreSyncWrapper<K>
where
K::Target: KVStoreSync,
Expand Down Expand Up @@ -213,6 +214,8 @@ where
/// **Note:** Users migrating custom persistence backends from the pre-v0.0.117 `KVStorePersister`
/// interface can use a concatenation of `[{primary_namespace}/[{secondary_namespace}/]]{key}` to
/// recover a `key` compatible with the data model previously assumed by `KVStorePersister::persist`.
///
/// This is not exported to bindings users as async is only supported in Rust.
pub trait KVStore {
/// Returns the data stored for the given `primary_namespace`, `secondary_namespace`, and
/// `key`.
Expand Down Expand Up @@ -717,6 +720,8 @@ where
/// Unlike [`MonitorUpdatingPersister`], this does not implement [`Persist`], but is instead used
/// directly by the [`ChainMonitor`] via [`ChainMonitor::new_async_beta`].
///
/// This is not exported to bindings users as async is only supported in Rust.
///
/// [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
/// [`ChainMonitor::new_async_beta`]: crate::chain::chainmonitor::ChainMonitor::new_async_beta
pub struct MonitorUpdatingPersisterAsync<
Expand Down
4 changes: 4 additions & 0 deletions lightning/src/util/sweep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ impl_writeable_tlv_based_enum!(OutputSpendStatus,
/// required to give their chain data sources (i.e., [`Filter`] implementation) to the respective
/// constructor.
///
/// This is not exported to bindings users as async is not supported outside of Rust.
///
/// [`Event::SpendableOutputs`]: crate::events::Event::SpendableOutputs
pub struct OutputSweeper<B: Deref, D: Deref, E: Deref, F: Deref, K: Deref, L: Deref, O: Deref>
where
Expand Down Expand Up @@ -979,6 +981,8 @@ where
/// this [`OutputSweeperSync`], fetching an async [`OutputSweeper`] won't accomplish much, all
/// the async methods will hang waiting on your sync [`KVStore`] and likely confuse your async
/// runtime. This exists primarily for LDK-internal use, including outside of this crate.
///
/// This is not exported to bindings users as async is not supported outside of Rust.
#[doc(hidden)]
pub fn sweeper_async(
&self,
Expand Down