Skip to content

Make everything async - #26

Closed
tnull wants to merge 22 commits into
lightningdevkit:mainfrom
tnull:2022-10-make-everything-async
Closed

Make everything async#26
tnull wants to merge 22 commits into
lightningdevkit:mainfrom
tnull:2022-10-make-everything-async

Conversation

@tnull

@tnulltnull commented Oct 20, 2022

Copy link
Copy Markdown
Collaborator

Based on #9, #10, #11.

We migrate BDK and other remaining blocking parts to async.

Comment threadsrc/access.rs
}
}

pub(crate) fn set_runtime(&self, tokio_runtime: Arc<tokio::runtime::Runtime>) {

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

I now have taken the approach of setting and dropping the runtime on start()/stop(). However, a probably cleaner alternative approach would be to use tokio::Runtime::enter upon setup and just storing the EnterGuard somewhere. However, this may result in panicking if we'd end up calling tokio::spawn out-of-context. As I'm currently not 100% sure that this could never happen, I now went with this uglier approach for the time being, but will look into it again.

@tnulltnull mentioned this pull request Oct 20, 2022
@tnull
tnullforce-pushed the 2022-10-make-everything-async branch from 623116a to bac34b5CompareOctober 20, 2022 14:38
Comment threadsrc/access.rs Outdated
return fallback_fee;
}

locked_runtime.as_ref().unwrap().block_on(async {

@tnulltnullOct 20, 2022

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

As block_on seems to have quite a few drawbacks even in the multithreaded runtime case I'll switch all of these to using spawn+mspc channels.

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Got rid of most of them, one non-trivial left for the moment.

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Might be blocked on bitcoindevkit/bdk#795, otherwise we need to run all wallet operations in it's own thread and keep it block_on.

@tnull
tnullforce-pushed the 2022-10-make-everything-async branch from bac34b5 to ed49984CompareOctober 21, 2022 11:50
We migrate BDK and other remaining blocking parts to async.
@tnull
tnullforce-pushed the 2022-10-make-everything-async branch from ed49984 to a6174dcCompareOctober 21, 2022 11:51
@tnulltnull mentioned this pull request Nov 7, 2022
@tnull

Copy link
Copy Markdown
CollaboratorAuthor

Closing as it became a requirement to already include this in #11.

@tnulltnull closed this Nov 30, 2022
joostjager pushed a commit to joostjager/ldk-node that referenced this pull request Jan 28, 2026
randomlogin added a commit to randomlogin/ldk-node that referenced this pull request Jun 9, 2026
* Add CBF chain source stubs for starting
* Add waiting for gossip propagation in tests
* Populate revealed spks for CBF
* Add sender and listener of `ChainOp`s
---------
Co-authored-by: Yeji Han <yeji.hvn@gmail.com>
randomlogin added a commit to randomlogin/ldk-node that referenced this pull request Jul 16, 2026
* Add CBF chain source stubs for starting
* Add waiting for gossip propagation in tests
* Populate revealed spks for CBF
* Add sender and listener of `ChainOp`s
---------
Co-authored-by: Yeji Han <yeji.hvn@gmail.com>
Sign up for freeto 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.

1 participant

@tnull