Skip to content

Commit

Permalink
feat: add sort in FilterLogs as extra check
Browse files Browse the repository at this point in the history
  • Loading branch information
5lliot committed Oct 16, 2023
1 parent 06f9a92 commit 7cdbe43
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/eth_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"math/big"
"net/http"
"sort"
"strconv"
"strings"

Expand Down Expand Up @@ -51,10 +52,10 @@ func (lf Node) GetLogs(fromBlock, toBlock int64, addrs []common.Address, topics
return logs, nil
}
}
// sort.SliceStable(logs, func(i, j int) bool {
// return logs[i].BlockNumber < logs[j].BlockNumber ||
// (logs[i].BlockNumber == logs[j].BlockNumber && logs[i].Index < logs[j].Index)
// })
sort.SliceStable(logs, func(i, j int) bool {
return logs[i].BlockNumber < logs[j].BlockNumber ||
(logs[i].BlockNumber == logs[j].BlockNumber && logs[i].Index < logs[j].Index)
})
return logs, err
}

Expand Down

0 comments on commit 7cdbe43

Please sign in to comment.