You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But it doesn't affect things because scorePrevBlock (not highScore) is used to compute the next scoreBlock:
scoreBlock = scorePrevBlock + difficulty
and scorePrevBlock scorePrevBlock = m_getScore(hashPrevBlock)
Note: there are also tests that verified that scores are expected. (Though there must be a missing/wront test that highScore is correct value after setInitialParent)
The text was updated successfully, but these errors were encountered:
Thank you for bringing this to my attention. It seems that there might be an inaccuracy in the initialization of highScore in the btcrelay contract. While the current implementation sets self.highScore = 1, you suggest that it should be self.highScore = chainWork for more accuracy.
However, it is important to note that this inaccuracy does not affect the functionality of the contract because scorePrevBlock, not highScore, is used to compute the next scoreBlock. The calculation is done as follows: scoreBlock = scorePrevBlock + difficulty.
Additionally, scorePrevBlock is obtained by calling m_getScore(hashPrevBlock). This means that the value of scorePrevBlock is used to determine the next score, not highScore.
It is worth mentioning that there are tests in place to verify the expected scores. However, it appears that there might be a missing or incorrect test to ensure that highScore has the correct value after setInitialParent.
I appreciate your attention to detail, and I will make a note of this discrepancy.
self.highScore = 1
should more accurately beself.highScore = chainWork
https://github.com/ethereum/btcrelay/blob/develop/btcrelay.se#L67
But it doesn't affect things because
scorePrevBlock
(not highScore) is used to compute the next scoreBlock:scoreBlock = scorePrevBlock + difficulty
and
scorePrevBlock
scorePrevBlock = m_getScore(hashPrevBlock)
Note: there are also tests that verified that scores are expected. (Though there must be a missing/wront test that
highScore
is correct value aftersetInitialParent
)The text was updated successfully, but these errors were encountered: