node: add an interface to retrieve node key from config

This commit is contained in:
Alan Chen 2017-06-19 18:16:03 +08:00 committed by mark.lin
parent e03ac4b7ae
commit fddd6635b5

View file

@ -17,6 +17,7 @@
package node package node
import ( import (
"crypto/ecdsa"
"reflect" "reflect"
"github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts"
@ -67,6 +68,11 @@ func (ctx *ServiceContext) Service(service interface{}) error {
return ErrServiceUnknown return ErrServiceUnknown
} }
// NodeKey returns node key from config
func (ctx *ServiceContext) NodeKey() *ecdsa.PrivateKey {
return ctx.config.NodeKey()
}
// ServiceConstructor is the function signature of the constructors needed to be // ServiceConstructor is the function signature of the constructors needed to be
// registered for service instantiation. // registered for service instantiation.
type ServiceConstructor func(ctx *ServiceContext) (Service, error) type ServiceConstructor func(ctx *ServiceContext) (Service, error)