mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-29 22:55:06 +03:00
Fix code style
This commit is contained in:
parent
34d5d4c245
commit
766c322958
1 changed files with 40 additions and 40 deletions
|
@ -1,63 +1,63 @@
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConfig_Keys(t *testing.T) {
|
func TestConfig_Keys(t *testing.T) {
|
||||||
var nodeConfig NodeConfig
|
var nodeConfig NodeConfig
|
||||||
|
|
||||||
if nodeConfig.PublicKey != "" {
|
if nodeConfig.PublicKey != "" {
|
||||||
t.Fatal("public key is not empty by default")
|
t.Fatal("public key is not empty by default")
|
||||||
}
|
}
|
||||||
|
|
||||||
if nodeConfig.PrivateKey != "" {
|
if nodeConfig.PrivateKey != "" {
|
||||||
t.Fatal("private key is not empty by default")
|
t.Fatal("private key is not empty by default")
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeConfig.NewKeys()
|
nodeConfig.NewKeys()
|
||||||
|
|
||||||
publicKey1, err := hex.DecodeString(nodeConfig.PublicKey)
|
publicKey1, err := hex.DecodeString(nodeConfig.PublicKey)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("can not decode generated public key")
|
t.Fatal("can not decode generated public key")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(publicKey1) == 0 {
|
if len(publicKey1) == 0 {
|
||||||
t.Fatal("empty public key generated")
|
t.Fatal("empty public key generated")
|
||||||
}
|
}
|
||||||
|
|
||||||
privateKey1, err := hex.DecodeString(nodeConfig.PrivateKey)
|
privateKey1, err := hex.DecodeString(nodeConfig.PrivateKey)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("can not decode generated private key")
|
t.Fatal("can not decode generated private key")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(privateKey1) == 0 {
|
if len(privateKey1) == 0 {
|
||||||
t.Fatal("empty private key generated")
|
t.Fatal("empty private key generated")
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeConfig.NewKeys()
|
nodeConfig.NewKeys()
|
||||||
|
|
||||||
publicKey2, err := hex.DecodeString(nodeConfig.PublicKey)
|
publicKey2, err := hex.DecodeString(nodeConfig.PublicKey)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("can not decode generated public key")
|
t.Fatal("can not decode generated public key")
|
||||||
}
|
}
|
||||||
|
|
||||||
if bytes.Equal(publicKey2, publicKey1) {
|
if bytes.Equal(publicKey2, publicKey1) {
|
||||||
t.Fatal("same public key generated")
|
t.Fatal("same public key generated")
|
||||||
}
|
}
|
||||||
|
|
||||||
privateKey2, err := hex.DecodeString(nodeConfig.PrivateKey)
|
privateKey2, err := hex.DecodeString(nodeConfig.PrivateKey)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("can not decode generated private key")
|
t.Fatal("can not decode generated private key")
|
||||||
}
|
}
|
||||||
|
|
||||||
if bytes.Equal(privateKey2, privateKey1) {
|
if bytes.Equal(privateKey2, privateKey1) {
|
||||||
t.Fatal("same private key generated")
|
t.Fatal("same private key generated")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue