indexers: use recordmode#372
Open
kcalvinalvin wants to merge 5 commits into
Open
Conversation
a4cd2fd to
47dfce8
Compare
Move the per-block replay logic out of the initConsistentUtreexoState loop into its own replayBlock method. Always use ModifyAndReturnTTLs since the Forest backend provides TTL data regardless of prune mode.
47dfce8 to
5587e9b
Compare
Add recordModeEndHeight parameter to InitUtreexoState and initConsistentUtreexoState. Add replayBlockRecord method that uses Forest.Record() to defer parent hash computation during crash recovery replay, calling HashAll() at the end height. Both callers pass -1 for now (no record mode), so there is no behavior change yet.
Add maxTTLStumpHeight() which computes the last TTL stump height from chaincfg params. Add recordModeEndHeight field and inRecordMode() method to both FlatUtreexoProofIndex and UtreexoProofIndex. The field is not yet wired up.
During IBD up to the TTL stump height, use Forest.Record() instead of Modify() to defer all parent hash computation. At the stump height, call HashAll() once and flush. This avoids expensive per-block SHA computations for blocks where proofs aren't needed. - Init: compute recordModeEndHeight, pass to InitUtreexoState - ConnectBlock: dispatch to connectBlockRecord in record mode - connectBlockRecord: Record(), empty proof/roots placeholders, real TTL data, HashAll+flush at boundary - attachBlock: use Record() in record mode - initUtreexoRootsState: skip record mode heights (no valid roots)
Same optimization as the flat index: during IBD up to the TTL stump height, use Forest.Record() instead of Modify() to defer parent hash computation. At the stump height, call HashAll() once, store the real utreexo state, and flush. - Init: compute recordModeEndHeight, pass to InitUtreexoState - ConnectBlock: dispatch to connectBlockRecord in record mode - connectBlockRecord: Record(), HashAll+store state+flush at boundary - initUtreexoRootsState: skip record mode heights - initBlockSummaryState: skip record mode heights
5587e9b to
6a5fd2a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.