WIP: Create an async corepc-client (adding async support to jsonrpc)#505
Draft
jamillambert wants to merge 7 commits intorust-bitcoin:masterfrom
Draft
WIP: Create an async corepc-client (adding async support to jsonrpc)#505jamillambert wants to merge 7 commits intorust-bitcoin:masterfrom
jamillambert wants to merge 7 commits intorust-bitcoin:masterfrom
Conversation
Code copy only to make it easier in the next patch to see what the changes are for async.
Remove code related to fuzzing from the new async files. These can be added back later once the async version is working.
In preparation for adding bitreq_http_async feature to jsonrpc move the sync version to the client-sync feature so it is not always on with jsonrpc.
Create a new folder for the upcoming async client and copy in the existing client_sync code. Code copy only to make the next patch easier to review.
Edit the copy of the sync client created in the previous commit to be async. Update the readme and cargo.toml files. Add only small set of RPCs.
d5524e1 to
9a77aa2
Compare
9a77aa2 to
6981d8f
Compare
Add some vibe coded tests for the async client to check that everything is functional. Tests are for development purposes only to catch simple errors like feature gates etc. and have not been reviewed.
6981d8f to
6cd8bb2
Compare
tcharding
reviewed
Feb 16, 2026
| /// Creates a new client with the given transport. | ||
| pub fn with_transport<T: Transport>(transport: T) -> Client { | ||
| Client { transport: Box::new(transport), nonce: atomic::AtomicUsize::new(1) } | ||
| pub fn with_transport<T: AsyncTransport>(transport: T) -> AsyncClient { |
Member
There was a problem hiding this comment.
My suggestion would be to not rename these types. That way the diff is smaller. I'd rename client.rs to client_sync.rs. You'll need to remove the public re-exports from lib.rs and that maybe fix up some paths to always use client_sync:: or client_async:: as appropriate.
tcharding
reviewed
Feb 16, 2026
| # A transport that uses `bitreq` as the async HTTP client. | ||
| bitreq_http_async = [ "base64", "bitreq", "bitreq/async" ] | ||
| # An async JSON-RPC client implementation. | ||
| client_async = [] |
Member
There was a problem hiding this comment.
Maybe this feature should enable bitreq_http_async?
tcharding
reviewed
Feb 16, 2026
| @@ -22,6 +22,10 @@ default = [ "simple_http", "simple_tcp" ] | |||
| simple_http = [ "base64" ] | |||
| # A transport that uses `bitreq` as the HTTP client. | |||
| bitreq_http = [ "base64", "bitreq" ] | |||
Member
There was a problem hiding this comment.
Maybe this should be re-name to bitreq_http_sync?
Member
|
@apoelstra whats your take man? Would you be willing to have |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Not a merge candidate. Proof of concept only.
This is PR option 1 of 2, both add an async corepc-client but in a slightly different ways. This version adds
asyncsupport tojsonrpc, the other adds the required part of jsonrpc into corepc-client (#506).The patches are structured to make it easier to see what was changed from sync to async. First the sync version is copied and renamed, then in a separate patch it is changed to async.