-
Notifications
You must be signed in to change notification settings - Fork 773
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
Blockchain: potential _headHeaderHash inconsistencies / bugs #1072
Comments
Side note: if my whole base assumption that these two fields should be in sync is not correct it would need some better explanation what the different purposes of these fields are. In case the assumption is correct, we should improve here and e.g. encapsulate the updates on both fields in a helper function to make this less error prone to update just one of the fields (code somewhat like here as an example of several code parts where both of the fields are updated). |
Yeah this is a good point. When I refactored |
This would still be a very useful refactoring. Needs some serious digging into the Blockchain library. |
I guess this is still an issue, even after all the (VM) v6 Blockchain refactoring work. |
Would still think this is an issue. |
yea seems like atleast at one place its still missing, can pick it up |
I think a gotcha here is that the You might first download headers over devp2p, and then once you get the headers you start downloading the blocks (over devp2p also, downloading block bodies). So, in this case your I think this is something to keep in mind. This nevertheless needs a good look, so we are consistent everywhere, and maybe indeed first lay down the "rules". For instance, what might work is that for any update of any of these values, check if the other counterpart is at a lower hash (i.e. lower block/header number), and if thats the case then also update the other value. |
This issue is NOT related to the latest stuff I wrote in the chat but some separate finding, I'll extract this as an issue since I wouldn't want to merge into #1068 and I would like to have some clear place for confirmation and discussion here before changing anything.
So the thing is that I have the impression that it is forgotten a couple of times to update the
_headHeaderHash
value along some update of the_headBlockHash
value.My current assumption here is that
_headHeaderHash
should always be updated if_headBlockHash
is updated, let me know if this is for some reason is not the case and I understand something wrong here.So following occurrences:
_putBlockOrHeader
here, missing_putBlockOrHeader
section from above as well here, missing_headHeaderHash
update_deleteCanonicalChainReferences
here, missing_headHeaderHash
update_rebuildCanonical()
here, missing_headHeaderHash
update_headBlockHash
//cc @jochem-brouwer
The text was updated successfully, but these errors were encountered: