mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-30 02:36:42 +00:00
Add the percentage report fix to v4 as well
This commit is contained in:
parent
df643f67cf
commit
7ffe83e4f1
@ -22,7 +22,12 @@ func newIBDProgressReporter(lowDAAScore uint64, highDAAScore uint64, objectName
|
|||||||
|
|
||||||
func (ipr *ibdProgressReporter) reportProgress(processedDelta int, highestProcessedDAAScore uint64) {
|
func (ipr *ibdProgressReporter) reportProgress(processedDelta int, highestProcessedDAAScore uint64) {
|
||||||
ipr.processed += processedDelta
|
ipr.processed += processedDelta
|
||||||
|
|
||||||
|
// Avoid exploding numbers in the percentage report, since the original `highDAAScore` might have been only a hint
|
||||||
|
if highestProcessedDAAScore > ipr.highDAAScore {
|
||||||
|
ipr.highDAAScore = highestProcessedDAAScore + 1 // + 1 for keeping it at 99%
|
||||||
|
ipr.totalDAAScoreDifference = ipr.highDAAScore - ipr.lowDAAScore
|
||||||
|
}
|
||||||
relativeDAAScore := highestProcessedDAAScore - ipr.lowDAAScore
|
relativeDAAScore := highestProcessedDAAScore - ipr.lowDAAScore
|
||||||
progressPercent := int((float64(relativeDAAScore) / float64(ipr.totalDAAScoreDifference)) * 100)
|
progressPercent := int((float64(relativeDAAScore) / float64(ipr.totalDAAScoreDifference)) * 100)
|
||||||
if progressPercent > ipr.lastReportedProgressPercent {
|
if progressPercent > ipr.lastReportedProgressPercent {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user