Skip to content

Commit

Permalink
Sort results in descending order
Browse files Browse the repository at this point in the history
  • Loading branch information
pschork committed Oct 17, 2024
1 parent fe8f7e7 commit 88d891b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/ejections/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func RunScan(ctx *cli.Context) error {
t := table.NewWriter()
t.AppendHeader(table.Row{"OperatorID", "Quorum", "Timestamp", "Txn"}, rowConfigAutoMerge)
sort.Slice(ejections, func(i, j int) bool {
return ejections[i].OperatorId < ejections[j].OperatorId
return ejections[i].BlockTimestamp > ejections[j].BlockTimestamp
})
for _, ejection := range ejections {
var link_prefix string
Expand All @@ -86,7 +86,10 @@ func RunScan(ctx *cli.Context) error {
t = table.NewWriter()
t.AppendHeader(table.Row{"Txn", "Timestamp", "OperatorId", "Quorum"}, rowConfigAutoMerge)
sort.Slice(ejections, func(i, j int) bool {
return ejections[i].TransactionHash < ejections[j].TransactionHash
if ejections[i].TransactionHash == ejections[j].TransactionHash {
return ejections[i].BlockTimestamp > ejections[j].BlockTimestamp
}
return ejections[i].TransactionHash > ejections[j].TransactionHash
})

for _, ejection := range ejections {
Expand Down

0 comments on commit 88d891b

Please sign in to comment.