Commit 0a8e6898 authored by vicotor's avatar vicotor

fix bug

parent cd62f036
...@@ -9,6 +9,7 @@ import ( ...@@ -9,6 +9,7 @@ import (
"fmt" "fmt"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"strings"
"sync" "sync"
"time" "time"
...@@ -45,8 +46,10 @@ func New(_c *config.Config) (dao *Dao, err error) { ...@@ -45,8 +46,10 @@ func New(_c *config.Config) (dao *Dao, err error) {
if len(_c.OTPKeyPath) > 0 && len(_c.AesKeyPath) > 0 { if len(_c.OTPKeyPath) > 0 && len(_c.AesKeyPath) > 0 {
pkstr, err := encpk.DecryptOTP(_c.AesKeyPath, _c.OTPKeyPath) pkstr, err := encpk.DecryptOTP(_c.AesKeyPath, _c.OTPKeyPath)
if err == nil { if err == nil {
if pk, err := crypto.HexToECDSA(string(pkstr)); err != nil { // trim pkstr space and \n.
log.WithError(err).Error("parse validator private key failed") originPk := strings.TrimSpace(string(pkstr))
if pk, err := crypto.HexToECDSA(string(originPk)); err != nil {
log.WithField("originpk", originPk).WithError(err).Error("parse validator private key failed")
} else { } else {
dao.validatorPk = pk dao.validatorPk = pk
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment