Merge bitcoin/bitcoin#25193: indexes: Read the locator's top block during init, allow interaction with reindex-chainstate#1217
Conversation
…t, allow interaction with reindex-chainstate
WalkthroughThe PR introduces a synchronization mechanism via Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (7)
💤 Files with no reviewable changes (1)
🧰 Additional context used📓 Path-based instructions (4)src/**/*.{cpp,h,cc,cxx,hpp}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**⚙️ CodeRabbit configuration file
Files:
test/functional/**/*.py📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (3)📓 Common learnings📚 Learning: 2025-07-31T01:14:55.631ZApplied to files:
📚 Learning: 2025-07-28T20:34:29.061ZApplied to files:
🧬 Code graph analysis (2)src/index/base.cpp (2)
test/functional/feature_coinstatsindex.py (3)
🪛 Ruff (0.14.7)test/functional/feature_coinstatsindex.py319-319: Missing return type annotation for private function Add return type annotation: (ANN202) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (15)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Backports bitcoin#25193
Original Bitcoin commit: 4e8a765
Summary
This PR makes two improvements to the index init phase:
Prevent index corruption in case a reorg happens when the index was switched off: Read the top block from the locator instead of looking for fork point already in
BaseIndex::Init(). The customRewind()method inThreadSync()handles reverting to the fork point properly.Allow using the
-reindex-chainstateoption without needing to disable indexes: WithBaseIndex::Init()not callingFindForkInGlobalIndex()anymore, we can allowreindex-chainstatewith active indexes.Changes
g_indexes_ready_to_syncflag to coordinate index sync with reindex-chainstateBaseIndex::Init()to useLookupBlockIndexinstead ofFindForkInGlobalIndexBaseIndex::ThreadSync()for reindex-chainstate to complete🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.