Skip to content
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

Mempool to jd server applications vendored rebased #632

Merged

Conversation

Fi3
Copy link
Collaborator

@Fi3 Fi3 commented Oct 8, 2023

No description provided.

@lorbax lorbax force-pushed the mempool-to-jd-server-applications-vendored-rebased branch 5 times, most recently from 08a7884 to 4758e68 Compare October 11, 2023 15:56
vendored jsonrpc is working and imported
adding boilerplate for mempool logic
add a method that retrieves the mempool, in which the transactions are
ordered by size.
All the logic of the rpc_client is moved in a separate file
rpc_client.rs
Now the struct JDsMempool has also a client, which is inizialized
in the new() method. The get_mempool() method becomes update_mempool
This is far better as for updateing a mempool we do not reinizialise an
rpc_clint but we use every time the same.
the function in /roles/jd-server/src/lib/mempool/mod.rs named
verify_short_id must be uncommented and modified to compile
@lorbax lorbax force-pushed the mempool-to-jd-server-applications-vendored-rebased branch 3 times, most recently from a16708e to 417e979 Compare October 12, 2023 16:22
the method update_memppol of JDsMempool now is non-blocking. What we pay
is a bit of performance, as we have to generate a new rpc client every
time we update the mempool. To fix this requires a major refactoring of
the rpc client, that I cannot do for lack of time
the mempool is initialized in main and gets updated every second
no errors in clippy, still few wornings to be solved. All except one are
relative to unsed variables. This variables are the inputs of the
function verify_short_id that still has to be implemented and will use
them.
The code can, and should, be tested.
now this relies on a function that calculates the ShortHashId of a
transaction, gicven a nonce and the txid. This is good as we can use
this function elsewhere.
refactored the function that calculates the short_hash_id of a
tyransaction given the txid and a nonce. Refacored the method that takes
a mempool and a short tx id and verifies that there is that tx in the
mempool. Now gives Some(tx, txid) in positive case, none otherwise.

With all this machinery now we can identify the transactions sent in the
declared mining job. The identified transaction are stored in a field of
JobDeclaratorDownstream. It is also added a field that indicates how
many transactions are unidentified. In the case this field is non zero,
the JDS must send a ProvideMissingTransactions to the JDC.
fix clippy wornings and rust tests that do not pass in json vendored
@lorbax lorbax force-pushed the mempool-to-jd-server-applications-vendored-rebased branch from 417e979 to f3fe4bb Compare October 12, 2023 16:29
@Fi3 Fi3 merged commit 2ab397f into stratum-mining:dev Oct 12, 2023
12 checks passed
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