On master the synchronous backfill always ran and blocked on initial_sync_complete, so the background task spawned afterwards could not start until IBD had finished. Stage 1 wrapped that backfill in `if !ohlcv_wiped`, which removed the barrier for the background task as a side effect. The guard fires more often than a version bump suggests: a fresh database has no version key, so `stored (None) != Some(OHLCV_VERSION)` and migrate_if_stale reports a wipe. Every clean resync therefore skipped the IBD-gated path entirely. Left ungated, the task sweeps from the first confirmed trade to `now - 3h` while indexing is still years behind. It materialises nothing, re-runs ~700 empty 24-hour batches every 600s, competes with block indexing for the cauldron write lock, and advances materialized_end to roughly now over an empty table -- after which candlesticks() takes the ohlcv fast path against nothing instead of falling back to the raw path. Waiting inside the spawned task rather than before the spawn keeps startup non-blocking. Tests: 239 passing Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .vscode | ||
| contrib | ||
| internal | ||
| linters | ||
| src | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| build.rs | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE | ||
| README.md | ||
Riftenlabs Indexer
RiftenLabs indexer is for indexing DeFi contracts by Riften Labs. It allows for querying historical on-chain data on Bitcoin Cash.
Contributing
All contributors are required to sign a Contributor License Agreement (CLA) before their contributions can be merged into the project.
Contributions are generally welcome. If you intend to make larger changes please discuss them in an issue before MRing them to avoid duplicate work and architectural mismatches.
Installing Rust
Rust can be installed using your package manager of choice or rustup.rs. The former way is considered more secure since it typically doesn't involve trust in the CA system. But you should be aware that the version of Rust shipped by your distribution might be out of date.
Building
The library can be built and tested using cargo:
git clone https://gitlab.com/riftenlabs/riftenlabs-indexer.git
cd riftenlabs-indexer
cargo build
You can run tests with:
cargo test