From fddd6635b56c2809924b5fabe75b20f557980eca Mon Sep 17 00:00:00 2001 From: Alan Chen Date: Mon, 19 Jun 2017 18:16:03 +0800 Subject: [PATCH] node: add an interface to retrieve node key from config --- node/service.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/node/service.go b/node/service.go index 55062a5004..d8ca95a372 100644 --- a/node/service.go +++ b/node/service.go @@ -17,6 +17,7 @@ package node import ( + "crypto/ecdsa" "reflect" "github.com/ethereum/go-ethereum/accounts" @@ -67,6 +68,11 @@ func (ctx *ServiceContext) Service(service interface{}) error { 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 // registered for service instantiation. type ServiceConstructor func(ctx *ServiceContext) (Service, error)