Skip to content

Commit

Permalink
feat: sort p2pIds for integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: 0xsuryansh <[email protected]>
  • Loading branch information
0xsuryansh committed Jul 10, 2024
1 parent 6922b39 commit db39b9b
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"math/big"
"sort"
"testing"
"time"

Expand Down Expand Up @@ -146,6 +147,16 @@ func P2pIDsFromInts(ints []int64) [][32]byte {
p2pID := p2pkey.MustNewV2XXXTestingOnly(big.NewInt(i)).PeerID()
p2pIDs = append(p2pIDs, p2pID)
}
sort.Slice(p2pIDs, func(i, j int) bool {
for k := 0; k < 32; k++ {
if p2pIDs[i][k] < p2pIDs[j][k] {
return true
} else if p2pIDs[i][k] > p2pIDs[j][k] {
return false
}
}
return false
})
return p2pIDs
}

Expand Down

0 comments on commit db39b9b

Please sign in to comment.