keys: change to []bytes (#4950)

This commit is contained in:
Marko
2020-06-04 15:32:42 +02:00
committed by GitHub
parent d53a8d0377
commit 7c576f02ab
21 changed files with 152 additions and 160 deletions

View File

@@ -1,6 +1,7 @@
package internal
import (
"bytes"
"fmt"
"net"
"os"
@@ -200,7 +201,7 @@ func (th *TestHarness) TestPublicKey() error {
return err
}
th.logger.Info("Remote", "pubKey", sck)
if fpvk != sck {
if !bytes.Equal(fpvk.Bytes(), sck.Bytes()) {
th.logger.Error("FAILED: Local and remote public keys do not match")
return newTestHarnessError(ErrTestPublicKeyFailed, nil, "")
}

View File

@@ -135,7 +135,7 @@ func extractKey(tmhome, outputPath string) {
keyFile := filepath.Join(internal.ExpandPath(tmhome), "config", "priv_validator_key.json")
stateFile := filepath.Join(internal.ExpandPath(tmhome), "data", "priv_validator_state.json")
fpv := privval.LoadFilePV(keyFile, stateFile)
pkb := [64]byte(fpv.Key.PrivKey.(ed25519.PrivKey))
pkb := []byte(fpv.Key.PrivKey.(ed25519.PrivKey))
if err := ioutil.WriteFile(internal.ExpandPath(outputPath), pkb[:32], 0600); err != nil {
logger.Info("Failed to write private key", "output", outputPath, "err", err)
os.Exit(1)