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

get_block_generator() fork detection #16867

Merged
merged 1 commit into from
Nov 18, 2023
Merged

Conversation

arvidn
Copy link
Contributor

@arvidn arvidn commented Nov 17, 2023

Purpose:

fix logic in get_block_generator() that determines whether we're looking up a block from a fork or the main chain.

Current Behavior:

We only consider a block lookup to be in the main chain if its previous block is in the cache.

New Behavior:

We consider block lookups part of the main chain if the previous block is in the database and its hash is the same as the height-to-hash map for that height.

testing

This change was tested by issuing the following RPC command:

chia rpc full_node get_puzzle_and_solution '{"coin_id": "0xdc43c91390490b8bbec628bf3c0c2388578548c1889f0ea40c6cfc8fac409947", "height": 280858}'

in main this freezes with this patch it returns the result quickly.

…ing up a block from a fork or the main chain
@arvidn arvidn added the Fixed Required label for PR that categorizes merge commit message as "Fixed" for changelog label Nov 17, 2023
@arvidn arvidn marked this pull request as ready for review November 17, 2023 23:25
@arvidn arvidn requested a review from a team as a code owner November 17, 2023 23:25
Copy link

Pull Request Test Coverage Report for Build 6909885509

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 18 unchanged lines in 8 files lost coverage.
  • Overall coverage increased (+0.03%) to 90.359%

Files with Coverage Reduction New Missed Lines %
chia/data_layer/data_layer.py 1 81.68%
chia/timelord/timelord_launcher.py 1 69.77%
chia/wallet/wallet_node.py 1 87.94%
tests/simulation/test_simulation.py 1 96.52%
chia/data_layer/data_layer_wallet.py 2 91.09%
chia/server/node_discovery.py 2 79.04%
chia/full_node/full_node.py 5 84.98%
chia/server/server.py 5 81.18%
Totals Coverage Status
Change from base Build 6898618925: 0.03%
Covered Lines: 93749
Relevant Lines: 103709

💛 - Coveralls

@arvidn arvidn requested a review from wjblanke November 18, 2023 13:10
Copy link
Contributor

@wjblanke wjblanke left a comment

Choose a reason for hiding this comment

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

works for me

@wjblanke wjblanke merged commit 886e79b into main Nov 18, 2023
252 of 253 checks passed
@wjblanke wjblanke deleted the get_block_generator-fork branch November 18, 2023 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed Required label for PR that categorizes merge commit message as "Fixed" for changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants