mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-30 15:15:07 +03:00
Fixed some linter issues
This commit is contained in:
parent
78b5f88e4b
commit
5c3b08c369
5 changed files with 34 additions and 40 deletions
|
@ -51,7 +51,7 @@ func main() {
|
|||
|
||||
for {
|
||||
newKey := <-newKeys
|
||||
if isBetter(currentBest[:], newKey.id[:]) || len(currentBest) == 0 {
|
||||
if isBetter(currentBest, newKey.id[:]) || len(currentBest) == 0 {
|
||||
currentBest = newKey.id
|
||||
for _, channel := range threadChannels {
|
||||
select {
|
||||
|
@ -61,13 +61,13 @@ func main() {
|
|||
fmt.Println("--------------------------------------------------------------------------------")
|
||||
switch {
|
||||
case *doSig:
|
||||
fmt.Println("sigPriv:", hex.EncodeToString(newKey.priv[:]))
|
||||
fmt.Println("sigPub:", hex.EncodeToString(newKey.pub[:]))
|
||||
fmt.Println("TreeID:", hex.EncodeToString(newKey.id[:]))
|
||||
fmt.Println("sigPriv:", hex.EncodeToString(newKey.priv))
|
||||
fmt.Println("sigPub:", hex.EncodeToString(newKey.pub))
|
||||
fmt.Println("TreeID:", hex.EncodeToString(newKey.id))
|
||||
default:
|
||||
fmt.Println("boxPriv:", hex.EncodeToString(newKey.priv[:]))
|
||||
fmt.Println("boxPub:", hex.EncodeToString(newKey.pub[:]))
|
||||
fmt.Println("NodeID:", hex.EncodeToString(newKey.id[:]))
|
||||
fmt.Println("boxPriv:", hex.EncodeToString(newKey.priv))
|
||||
fmt.Println("boxPub:", hex.EncodeToString(newKey.pub))
|
||||
fmt.Println("NodeID:", hex.EncodeToString(newKey.id))
|
||||
fmt.Println("IP:", newKey.ip)
|
||||
}
|
||||
}
|
||||
|
@ -76,12 +76,10 @@ func main() {
|
|||
|
||||
func isBetter(oldID, newID []byte) bool {
|
||||
for idx := range oldID {
|
||||
if newID[idx] > oldID[idx] {
|
||||
return true
|
||||
}
|
||||
if newID[idx] < oldID[idx] {
|
||||
return false
|
||||
if newID[idx] == oldID[idx] {
|
||||
continue
|
||||
}
|
||||
return newID[idx] > oldID[idx]
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue