diff --git a/daemon/jobs/chainsync.go b/daemon/jobs/chainsync.go index 5d12cd9..9412273 100644 --- a/daemon/jobs/chainsync.go +++ b/daemon/jobs/chainsync.go @@ -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) @@ -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 { diff --git a/util/utility.go b/util/utility.go index 363adcb..08ca763 100644 --- a/util/utility.go +++ b/util/utility.go @@ -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