Skip to content

Commit

Permalink
Merge pull request #2018 from ergoplatform/nipopow-proof-fix
Browse files Browse the repository at this point in the history
Check for diff header to be before suffix
  • Loading branch information
kushti authored Jul 29, 2023
2 parents e206afb + 7e3f061 commit 3561825
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,12 @@ class NipopowAlgos(val chainSettings: ChainSettings) {
// put headers needed to check difficulty of new blocks after suffix into prefix
val epochLength = chainSettings.eip37EpochLength.getOrElse(chainSettings.epochLength)
diffAdjustment.heightsForNextRecalculation(suffixHead.height, epochLength).foreach { height =>
histReader.popowHeader(height).foreach { ph =>
prefixBuilder += ph
storedHeights += ph.height
// check that header in or after suffix is not included, otherwise, sorting by height would be broken
if (height < suffixHead.height) {
histReader.popowHeader(height).foreach { ph =>
prefixBuilder += ph
storedHeights += ph.height
}
}
}
}
Expand Down

0 comments on commit 3561825

Please sign in to comment.