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
We can have empty block_logs and fork_db, and when that happens APIs like fork_db.root() and blog.first_block_num() make up credible values that are not always consistent. For example, in controller.cpp::log_irreversible(), we retrieve the blog head with:
block_id_type log_head_id = blog.head_id(); which always return a sha256, and the we check if it is valid by checking if it is all zeros.
And if it is invalid, then we check that fork_db.root()->block_num == blog.first_block_num() - 1.
It seems to me that if we had blog.head_id() returning an empty std::optional to mean that the blog is empty, then maybe the only think we would need to check in the assert is that fork_db.root() also return std::nullopt.
PS: If I messed up the explanation, Kevin understands what I mean and is welcome to fix it.
The text was updated successfully, but these errors were encountered:
The odd invariant we are currently maintaining is first_block_num() returning a block number for a block that is actually not in the block log. This clearly looks like a hack.
We can have empty
block_logs
andfork_db
, and when that happens APIs likefork_db.root()
andblog.first_block_num()
make up credible values that are not always consistent. For example, incontroller.cpp::log_irreversible()
, we retrieve the blog head with:block_id_type log_head_id = blog.head_id();
which always return asha256
, and the we check if it is valid by checking if it is all zeros.And if it is invalid, then we check that
fork_db.root()->block_num == blog.first_block_num() - 1
.It seems to me that if we had
blog.head_id()
returning an emptystd::optional
to mean that the blog is empty, then maybe the only think we would need to check in the assert is thatfork_db.root()
also return std::nullopt.PS: If I messed up the explanation, Kevin understands what I mean and is welcome to fix it.
The text was updated successfully, but these errors were encountered: