Skip to content
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

feat: sync up to latest micro-block #726

Merged
merged 1 commit into from
Jun 29, 2022
Merged

feat: sync up to latest micro-block #726

merged 1 commit into from
Jun 29, 2022

Conversation

sborrazas
Copy link
Contributor

No description provided.

@sborrazas sborrazas requested review from thepiwo and jyeshe June 16, 2022 20:07
@sborrazas sborrazas self-assigned this Jun 16, 2022
def get_blocks_per_height(from_height, to_height) when is_integer(to_height) do
{:ok, header} = :aec_chain.get_key_header_by_height(to_height + 1)

last_mb_hash = :aec_headers.prev_hash(header)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some "empty" generations (without microblocks).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is contemplated by the get_blocks_per_height, mbs will be an empty array

@@ -163,7 +166,7 @@ defmodule AeMdw.Sync.Server do

new_state_data = %__MODULE__{
state_data
| mem_height: State.height(new_db_state),
| mem_hash: State.height(new_db_state),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implement something like State.height_hash ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should have been set to nil, ultimately the result was the same, but mem_hash should have always been either a hash or nil. Fixed now, thanks

@sborrazas sborrazas requested a review from jyeshe June 23, 2022 17:24
Copy link
Member

@jyeshe jyeshe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! optionally would rename or add comment for someone eventually debugging to indicate that it is already handling the case when last_mb_hash = prev_kb_hash

Base automatically changed from mem-store to master June 29, 2022 20:44
@sborrazas sborrazas merged commit bff7d0f into master Jun 29, 2022
@sborrazas sborrazas deleted the mb-mem-sync branch June 29, 2022 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants