You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #7272: perf: pass pre-computed block hash through reindex path to avoid redundant X11 computations
6e138f0 review: document known_hash safety and fix test to exercise reindex path (UdjinM6)
01af278 refactor: return std::optional<uint256> from ReadBlockFromDisk(FlatFilePos) (UdjinM6)
89d8c45 assert: use ASSERT_IF_DEBUG for known_hash invariants (UdjinM6)
01e72cb test: exercise CheckBlock and AcceptBlock with pre-computed known_hash (UdjinM6)
ec87196 assert: add debug-only invariant to verify known_hash matches block hash (UdjinM6)
f7c43a2 perf: pass pre-computed block hash through reindex path to avoid redundant X11 (UdjinM6)
Pull request description:
## Issue being fixed or feature implemented
During reindex, the X11 block header hash was computed multiple times for the same block: once in `LoadExternalBlockFile`, again in `AcceptBlockHeader`, again in `CheckBlock`, and more for out-of-order blocks.
See #6610 for more info.
## What was done?
Thread the already-computed hash through `AcceptBlock`, `AcceptBlockHeader`, `CheckBlock`, and `ReadBlockFromDisk` to eliminate redundant X11 computations (from 3-5 per block down to 1).
## How Has This Been Tested?
Reindexed on testnet with `--stopatheight=1` to confirm performance is on par with #6610. Then competed reindex on testnet with no issues. Tests are green too.
## Breaking Changes
n/a
## Checklist:
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e tests
- [ ] I have made corresponding changes to the documentation
- [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_
Top commit has no ACKs.
Tree-SHA512: 473fb7bf177c721f8d0f50e04394015554e779b26b1f004e52efb7803d267a13692a0f6a31426f084f1fbc25d2db44a56b0621fe7ed1b65c9c49ed322d98f1e9
0 commit comments