Skip to content

Commit

Permalink
Fix Linting errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
tiger5226 committed Dec 8, 2019
1 parent 8f07337 commit 79b3014
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions daemon/jobs/chainsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ func ChainSync() {

timeLimit := time.Now().Add(time.Duration(ChainSyncRunDuration) * time.Second)
for time.Now().Before(timeLimit) && chainSync.LastHeight < chainSync.MaxHeightStored {
chainSync.processNextBlock()
err := chainSync.processNextBlock()
if err != nil {
logrus.Debugf("FAILURE @%d: %s", chainSync.LastHeight, err.Error())
}
time.Sleep(time.Duration(ChainSyncDelay) * time.Millisecond)
}
doneChainSyncJob(job)
Expand All @@ -79,7 +82,7 @@ type chainSyncStatus struct {
JobStatus *model.JobStatus `json:"-"`
LastHeight int64 `json:"last_height"`
MaxHeightStored int64 `json:"max_height_stored"`
Errors []syncError `json:"errors""`
Errors []syncError `json:"errors"`
}

type syncError struct {
Expand Down
2 changes: 2 additions & 0 deletions util/utility.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ func ReverseBytes(b []byte) []byte {
return r
}

//Round will round based on 0.5 any float passed to it.
func Round(num float64) int {
return int(num + math.Copysign(0.5, num))
}

//ToFixed will fix the precision of a float rounding if needed.
func ToFixed(num float64, precision int) float64 {
output := math.Pow(10, float64(precision))
return float64(Round(num*output)) / output
Expand Down

0 comments on commit 79b3014

Please sign in to comment.