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

fix(brc20): verify ordinal transfers in chunks instead of individually #394

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

rafaelcr
Copy link
Collaborator

@rafaelcr rafaelcr commented Feb 3, 2025

Some Bitcoin blocks contain tens of thousands (or hundreds of thousands) of ordinal transfers. The BRC-20 indexer needs to look at each of these to see if any transfer operation was sent to another address (thus generating a transfer_send operation). This is currently extremely slow on our production deployments because it represents 1 roundtrip to postgres for every transfer we need to check.

This PR makes sure that when we analyze these we do so in chunks in order to minimize the roundtrip overhead to and from postgres thus making indexing much faster.

@rafaelcr rafaelcr requested a review from ASuciuX February 3, 2025 20:51
Copy link

codecov bot commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 93.71429% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rdhook-core/src/core/meta_protocols/brc20/cache.rs 70.83% 7 Missing ⚠️
...ook-core/src/core/meta_protocols/brc20/brc20_pg.rs 86.66% 2 Missing ⚠️
...rdhook-core/src/core/meta_protocols/brc20/index.rs 98.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@rafaelcr rafaelcr had a problem deploying to Development-mainnet-blue February 3, 2025 21:17 — with GitHub Actions Error
@rafaelcr rafaelcr requested a deployment to Development-mainnet-blue February 4, 2025 00:20 — with GitHub Actions Waiting
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.

1 participant