-
Notifications
You must be signed in to change notification settings - Fork 741
stop persisting rejected blocks on P-chain #1696
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
stop persisting rejected blocks on P-chain #1696
Conversation
@@ -1486,11 +1488,11 @@ func (s *state) init(genesisBytes []byte) error { | |||
return s.Commit() | |||
} | |||
|
|||
func (s *state) AddStatelessBlock(block blocks.Block, status choices.Status) { | |||
func (s *state) AddStatelessBlock(block blocks.Block) { |
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.
nit: should we err if the block status is not actually accepted?
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.
We don't have that information here.
AddStatelessBlock(block blocks.Block, status choices.Status) | ||
|
||
// Invariant: [block] is an accepted block. | ||
AddStatelessBlock(block blocks.Block) |
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.
nit: should we rename this AddStatelessAcceptedBlock for clarify? Maybe it's too long of name
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.
I feel like this change would be reverted when we remove status from GetStatelessBlock
@dhrubabasu also nit: we cannot yet remove the status from GetStatelessBlock right? Not until we purge rejected blocks |
We could make it so that Talked with Dhruba offline - going to leave this as part of the followup. |
Why this should be merged
Works towards resolving #1623
How this works
We only call
AddStatelessBlock
with accepted blocks, removing future rejected blocks from being persisted to memory or disk.Note: existing rejected blocks on disk are still there, a future PR will be made to prune them.
How this was tested
CI