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

Blockchain rpcs #323

Merged
merged 5 commits into from
Jan 8, 2025
Merged

Conversation

Davidson-Souza
Copy link
Collaborator

@Davidson-Souza Davidson-Souza commented Dec 30, 2024

Depends on #322

This is the first step towards a core-compatible(ish) json rpc. This should help other applications to integrate with florestad without requiring any additional work.

List of things achieved here:

  • Refactor node to have RPCs grouped per file (done for blockchain)
  • Rename RPCs to allign with core (done for blockchain)
  • Implement all RPCs that are trivial to (if it needs more work, they'll have their own PR)

Things that we'll need to build next (not done here):

  • Make sure all RPCs return the same thing as core v28
  • Non-trivial RPCs
  • A cross-test between floresta and core. Ideally, we would have a test that sends the same RPCs to core and florestad, checks if they return the same. We should have one that does that against different versions of core, and one that runs every week or something like this, testing our master and theirs.

If we do all rpcs inside `server.rs` it'll grow and become a huge file,
this commit creates a blockchain module where we define all
blockchain-related rpcs as defined by core[1] docs.

[1]: https://bitcoincore.org/en/doc/28.0.0/rpc
This commit implements some very basic rpcs from bitcoin core that can
be implmented without much changes inside floresta itself. Only blockchain
rpcs were implemented here.
The rpcs that uses `NodeHandle` can cause our runtime to deadlock,
because we await on a sync oneshot channel to wait for the awnser. But
if the `UtreexoNode` task is running on the same worker, there's no way
it could ever resolve. This causes floresta to halt.

This commit fixes it by only calling these funtions inside a blocking
task, where blocking is fine.

A more long-term solution would be a true async handle.
@Davidson-Souza Davidson-Souza marked this pull request as ready for review January 7, 2025 20:52
@Davidson-Souza Davidson-Souza merged commit 134b9d9 into vinteumorg:master Jan 8, 2025
6 checks passed
@Gudnessuche
Copy link
Contributor

no Get Block Temmplate & Get Tx Outset Info?

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