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

Batch block hash and header requests using hyper #1812

Closed
wants to merge 8 commits into from

Conversation

andrewtoth
Copy link
Contributor

@andrewtoth andrewtoth commented Feb 21, 2023

Following up on #1759, this PR uses hyper for all json-rpc requests in updater.rs. It also batches requests for block hashes and headers 2000 at a time. With this method I was able to sync to 777563 in 38 minutes.

There are other benefits to using hyper aside from batching. The bitcoincore-rpc library times out when not in use for a long time, which results in JSON-RPC errors reported in several issues. This happens during long commits when doing a full index, which is why all the retry logic was necessary. It also happens when calling index.client.get_block_count at the end of the index when that client was not called for a long time (also fixed in https://github.com/casey/ord/pull/1637). Using hyper in all these cases will no longer cause these issues.

@andrewtoth
Copy link
Contributor Author

Not sure why the core test is failing. Seems intermittent but I can't retry it.

@raphjaph
Copy link
Collaborator

Not sure why the core test is failing. Seems intermittent but I can't retry it.

Yeah, we have one particularly flaky test, where we spin up a real Bitcoin Core instance. I'm just going to run this again

@andrewtoth
Copy link
Contributor Author

@raphjaph there was a conflict with #1637 that also removed need for clones in your last commit.

@casey
Copy link
Collaborator

casey commented Feb 12, 2024

I think the first step is using hyper in the bitcoin core RPC, and then later see about batching. See #3106.

@casey casey closed this Feb 12, 2024
@Jrbiltmore
Copy link

Jrbiltmore commented Feb 12, 2024 via email

@Jrbiltmore
Copy link

Jrbiltmore commented Feb 12, 2024 via email

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.

4 participants