Skip to content

Async KV Store #3778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Conversation

joostjager
Copy link
Contributor

Draft PR for discussion on approach

Relates to #1470

Async closures are complicated. Preparatory commit.
Convert methods that need to be async when the wallet traits become
async.
It seems that the compiler doesn't recognize the drop and complains
that the mutex crosses an await (introduced in later commit), even
though it doesn't.
Async closures are complicated. Preparatory commit.
Changes the CoinSelectionSource and WalletSource traits to be async and
provides WalletSourceSyncWrapper to as a helper for users that want to
implement a sync wallet source.

TestWalletSource is kept sync, to prevent a cascade of async conversions
in tests.
@ldk-reviews-bot
Copy link

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

Poll::Pending => {
println!("Future not ready, using tokio runtime");

self.runtime.spawn(async move {
Copy link
Contributor Author

@joostjager joostjager May 15, 2025

Choose a reason for hiding this comment

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

This doesn't need to be tokio, it could be a generic spawn method too of course.


match fut.as_mut().poll(&mut cx) {
Poll::Ready(_) => {
UpdateStatus::Completed
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This initiates the stable persistence flow in LDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants