-
Notifications
You must be signed in to change notification settings - Fork 674
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
Check P-chain ShouldPrune during Initialize #1836
Conversation
shouldPrune, err := s.shouldPrune() | ||
if err != nil { | ||
lock.Unlock() | ||
return fmt.Errorf( | ||
"failed to check if the database should be pruned: %w", | ||
err, | ||
) | ||
} | ||
if !shouldPrune { | ||
lock.Unlock() | ||
|
||
log.Info("state already pruned and indexed") | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check was moved into vm.Initialize
} | ||
if !shouldPrune { | ||
chainCtx.Log.Info("state already pruned and indexed") | ||
vm.pruned.Set(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By setting pruned
here - we guaranteed that we will return nil
from VerifyHeightIndex
if the P-chain has already been pruned (even if it is called immediately after Initialize
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me
Why this should be merged
Ensures the proposervm doesn't repair its own index multiple times.
How this works
Verifies the platformvm height index on initialize.
How this was tested
CI