Skip to content

Commit

Permalink
fix: polycli monitor block order (#40)
Browse files Browse the repository at this point in the history
* chore: remove dead code

* fix: compare block numbers if timestamps are equal

* refactor: compare blocks only by their blockNumber property
  • Loading branch information
leovct authored Feb 16, 2023
1 parent d4b6170 commit 9999e48
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions cmd/monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ var MonitorCmd = &cobra.Command{

from := big.NewInt(0)

// batchSize := *inputBatchSize
// if *inputBatchSize > 0 {
// batchSize = *inputBatchSize
// }

// if the max block is 0, meaning we haven't fetched any blocks, we're going to start with head - batchSize
if ms.MaxBlockRetrieved.Cmp(from) == 0 {
headBlockMinusBatchSize := new(big.Int).SetUint64(*inputBatchSize + 100 - 1)
Expand Down
2 changes: 1 addition & 1 deletion metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (a SortableBlocks) Swap(i, j int) {
a[i], a[j] = a[j], a[i]
}
func (a SortableBlocks) Less(i, j int) bool {
return a[i].Time() < a[j].Time()
return a[i].Number().Int64() < a[j].Number().Int64()
}

func GetMeanBlockTime(blocks []rpctypes.PolyBlock) float64 {
Expand Down

0 comments on commit 9999e48

Please sign in to comment.