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

Filter out minor block headers with larger create time #780

Merged
merged 5 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions quarkchain/cluster/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,7 @@ async def add_root_block(self, r_block: RootBlock):
self.root_state.write_committing_hash(r_block.header.get_hash())

adjusted_diff = await self.__adjust_diff(r_block)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will remove in the next commit (if any).

Copy link
Contributor

Choose a reason for hiding this comment

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

remove it!

try:
update_tip = self.root_state.add_block(r_block, adjusted_diff=adjusted_diff)
except ValueError as e:
Expand Down
3 changes: 3 additions & 0 deletions quarkchain/cluster/root_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ def create_block_to_mine(self, m_header_list, address=None, create_time=None):
block = self.tip.create_block_to_append(
create_time=create_time, address=address, difficulty=difficulty
)

# Filter out minor blocks with greater create_time
m_header_list = [h for h in m_header_list if h.create_time <= create_time]
block.minor_block_header_list = m_header_list

coinbase_tokens = self._calculate_root_block_coinbase(
Expand Down