Skip to content

[WIP] new rpc-client for JD-Server mempool#716

Closed
lorbax wants to merge 8 commits intostratum-mining:devfrom
lorbax:jd-server-mini-rpc-client-rebased
Closed

[WIP] new rpc-client for JD-Server mempool#716
lorbax wants to merge 8 commits intostratum-mining:devfrom
lorbax:jd-server-mini-rpc-client-rebased

Conversation

@lorbax
Copy link
Collaborator

@lorbax lorbax commented Jan 10, 2024

What is in this PR.

A new Rpc client, called MiniRpcClient. This client communicates with a bitcoin node, and the requests that can do are just the following: ask for the mempool, ask for a specific transaction, submit a bitcoin block. This client is used to make the jd-server mempool communicate with the bitcoin node. The previous client was depending upon json-rpc library, which caused some issues because imported serde in a way that the SRI "doesn't like". This rpc client is made on top of the latest hyper 1.1.0 library for http connections.

The code is asynchronous and non blocking. Before was "almost" non blocking, as the function "submit_block" that concearned submitting a block to the bitcoin node, was blocking.

I also took advantage of introduce some proper error management in the jds mempool module.

There are still some clippyu warning and the code still need to be tested properly, this is why is marked as "Work in Progress".

@lorbax lorbax changed the title WIP Jd server mini rpc client rebased [WIP] new rpc client for JD-Server mempool Jan 10, 2024
@lorbax lorbax changed the title [WIP] new rpc client for JD-Server mempool [WIP] new rpc-client for JD-Server mempool Jan 10, 2024
@pavlenex pavlenex added this to the Milestone4 milestone Jan 17, 2024
@lorbax lorbax force-pushed the jd-server-mini-rpc-client-rebased branch 2 times, most recently from 6cba292 to 9c38b68 Compare January 21, 2024 19:50
Add a new script that compiles all the worspaces at once. This is useful
because after the workspace split all the remaining workspaces have to
be compiled separately, which is not practical
mini_rcp_client module added, removed dependance over previous
rcp_client. Also added task where the mempool listed if submit_solution
arrives, in order to send the block to bitcoin node. Still very much
WIP, only compiles
Now the JDS, when receives the SubmitSolution, construct the block send
sends its hex serialization to the mempool. At the same time, an asyc
tast on main makes the mempool listen for new hex_encoded blocks. When
one arrives, it is submitted to the bitcoin node via the MiniRpcclient.
Note that this task of submitting a solution to the bitcoin node before
was blocking and now it is async.
No more reckless unwrap in "mempool" module code. Good error management
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