-
Notifications
You must be signed in to change notification settings - Fork 24
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
Enforce block index invariants in chainstate #1708
Conversation
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.
First round done. I'll review again tomorrow.
… replace get_block_index in ChainstateInterface with get_any_block_index/get_persistent_block_index and use the latter in production whenever possible
…h a custom function
… via assert_not_impl_any.
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.
Looks good. Though I'm not a fan of new functions in BlockchainStorageRead
and it feels like they belong to chainstate/storage/src/internal/expensive.rs
. But I don't see the way to actually do that so let it be.
aa59061
to
1484d16
Compare
…redundant "with_chainstate_config" calls for TestFramework.
is_persistent
flag was added toBlockIndex
, which means that thisBlockIndex
will never be deleted (until we implement purging, that is). In practice, aBlockIndex
is persistent iff the correspondingBlock
is in the chainstate db.ChainstateInterface
,get_block_index/get_gen_block_index
were replaced withget_persistent_block_index/get_any_block_index
andget_persistent_gen_block_index/get_any_gen_block_index
; theget_persistent
variants only return aBlockIndex
is it's marked as "persistent".TestFramework
.