From 49eabb5773eb6c252f863108c989957a3bbfa129 Mon Sep 17 00:00:00 2001 From: Edwin Date: Mon, 21 Aug 2017 17:15:14 +0800 Subject: [PATCH] container: add Address function for interface --- container/ethereum.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/container/ethereum.go b/container/ethereum.go index 172f4375..46cd12fc 100644 --- a/container/ethereum.go +++ b/container/ethereum.go @@ -36,7 +36,9 @@ import ( "github.com/docker/docker/client" "github.com/docker/go-connections/nat" "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/p2p/discover" @@ -59,6 +61,7 @@ type Ethereum interface { Stop() error NodeAddress() string + Address() common.Address ContainerID() string Host() string @@ -363,6 +366,10 @@ func (eth *ethereum) NodeAddress() string { return "" } +func (eth *ethereum) Address() common.Address { + return crypto.PubkeyToAddress(eth.key.PublicKey) +} + func (eth *ethereum) ConsensusMonitor(errCh chan<- error, quit chan struct{}) { cli := eth.NewClient()