Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions pkg/consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package consensus
import (
"errors"
"fmt"
"sort"
"slices"
"strings"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -378,9 +378,7 @@ func (c *Consensus) setNodes(nodes []uint64) {
func sortNodes(nodes []uint64) []uint64 {
sorted := make([]uint64, len(nodes))
copy(sorted, nodes)
sort.Slice(sorted, func(i, j int) bool {
return sorted[i] < sorted[j]
})
slices.Sort(sorted)
return sorted
}

Expand Down
7 changes: 2 additions & 5 deletions pkg/wal/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"io"
"os"
"path/filepath"
"slices"
"sort"
"strings"

Expand Down Expand Up @@ -132,11 +133,7 @@ func checkWalFiles(logger api.Logger, dirName string, walNames []string) ([]uint
}
}

sort.Slice(indexes,
func(i, j int) bool {
return indexes[i] < indexes[j]
},
)
slices.Sort(indexes)

return indexes, nil
}
Expand Down
4 changes: 2 additions & 2 deletions test/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package test
import (
"fmt"
"math/rand"
"sort"
"slices"
"sync"

"github.com/hyperledger-labs/SmartBFT/smartbftprotos"
Expand Down Expand Up @@ -213,7 +213,7 @@ func (node *Node) SendTransaction(targetID uint64, request []byte) {
// Nodes returns the ids of all nodes in the network
func (node *Node) Nodes() []uint64 {
res := node.n.getAll()
sort.Slice(res, func(i, j int) bool { return res[i] < res[j] })
slices.Sort(res)
return res
}

Expand Down