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

Fix gapless reverse blockheader search #5018

Merged
merged 6 commits into from
Dec 15, 2022

Conversation

LukaszRozmej
Copy link
Member

Fixes #5017

Changes:

  • Fix for faster version of GetBlockHeaders to properly support reverse flag.

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Other (please describe):

Testing

Requires testing

  • Yes
  • No

In case you checked yes, did you write tests??

  • Yes
  • No

@@ -946,14 +946,48 @@ public BlockHeader[] FindHeaders(Keccak? blockHash, int numberOfBlocks, int skip

if (skip == 0)
{
static BlockHeader[] FindHeadersReversedFast(BlockTree tree, BlockHeader startHeader, int numberOfBlocks, bool reverse = false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why move in?

Copy link
Member Author

Choose a reason for hiding this comment

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

To be closer to only place where it is used.

AddToMain(blockTree, block0);
AddToMain(blockTree, block1);
AddToMain(blockTree, block2);
AddToMain(blockTree, block3);
AddToMain(blockTree, block4);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this did not catch the issue before? Should you update this test somehow on line 444?

Copy link
Member Author

Choose a reason for hiding this comment

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

BlockTree didn't have any blocks past the requested one, which caused endBlock - how it was previously calculated to always be null

@LukaszRozmej LukaszRozmej merged commit d3c4e3a into master Dec 15, 2022
@LukaszRozmej LukaszRozmej deleted the fix/GetBlockHeaders_reverse branch December 15, 2022 20:37
MarekM25 pushed a commit that referenced this pull request Dec 16, 2022
* Fix gapless reverse blockheader search

* Increase times to stabilize pipeline

* Revert "Increase times to stabilize pipeline"

This reverts commit 69193f0.

* disable EngineModuleTests parallelization

* Revert "disable EngineModuleTests parallelization"

This reverts commit 0238cd6.

* fix tests

(cherry picked from commit d3c4e3a)
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.

GetBlockHeaders, Reverse: true
2 participants