From 9723191b19f6ddc12f0c3376ede7529b2d72e6a2 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Mon, 9 Mar 2015 11:04:38 -0500 Subject: [PATCH] Undo client_version changes --- cmd/ethereum/main.go | 3 ++- cmd/mist/main.go | 4 ++-- eth/backend.go | 5 +---- ethutil/common.go | 4 ---- p2p/server.go | 10 +++++++++- rpc/api.go | 2 -- xeth/xeth.go | 5 ----- 7 files changed, 14 insertions(+), 19 deletions(-) diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index afb90d72a..f79f948d1 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -31,6 +31,7 @@ import ( "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/state" ) @@ -61,7 +62,7 @@ func main() { utils.InitConfig(VmType, ConfigFile, Datadir, "ETH") ethereum, err := eth.New(ð.Config{ - Name: ethutil.MakeVersion(ClientIdentifier, Version), + Name: p2p.MakeName(ClientIdentifier, Version), KeyStore: KeyStore, DataDir: Datadir, LogFile: LogFile, diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 0ece20d2c..c9a07bfde 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -28,8 +28,8 @@ import ( "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/ui/qt/webengine" "github.com/obscuren/qml" ) @@ -52,7 +52,7 @@ func run() error { config := utils.InitConfig(VmType, ConfigFile, Datadir, "ETH") ethereum, err := eth.New(ð.Config{ - Name: ethutil.MakeVersion(ClientIdentifier, Version), + Name: p2p.MakeName(ClientIdentifier, Version), KeyStore: KeyStore, DataDir: Datadir, LogFile: LogFile, diff --git a/eth/backend.go b/eth/backend.go index 27d3f3b3f..f67f9c78b 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -132,8 +132,7 @@ type Ethereum struct { logger ethlogger.LogSystem - Mining bool - version string + Mining bool } func New(config *Config) (*Ethereum, error) { @@ -176,7 +175,6 @@ func New(config *Config) (*Ethereum, error) { blacklist: p2p.NewBlacklist(), eventMux: &event.TypeMux{}, logger: logger, - version: config.Name, } eth.chainManager = core.NewChainManager(db, eth.EventMux()) @@ -233,7 +231,6 @@ func (s *Ethereum) PeerCount() int { return s.net.PeerCoun func (s *Ethereum) Peers() []*p2p.Peer { return s.net.Peers() } func (s *Ethereum) MaxPeers() int { return s.net.MaxPeers } func (s *Ethereum) Coinbase() []byte { return nil } // TODO -func (s *Ethereum) ClientVersion() string { return s.version } // Start the ethereum func (s *Ethereum) Start() error { diff --git a/ethutil/common.go b/ethutil/common.go index 88f4cd189..9b66763b8 100644 --- a/ethutil/common.go +++ b/ethutil/common.go @@ -13,10 +13,6 @@ import ( "github.com/kardianos/osext" ) -func MakeVersion(name, version string) string { - return fmt.Sprintf("%s/v%s/%s/%s", name, version, runtime.GOOS, runtime.Version()) -} - func DefaultAssetPath() string { var assetPath string pwd, _ := os.Getwd() diff --git a/p2p/server.go b/p2p/server.go index 25da04cd9..3ea2538d1 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "net" + "runtime" "sync" "time" @@ -23,6 +24,13 @@ const ( var srvlog = logger.NewLogger("P2P Server") var srvjslog = logger.NewJsonLogger() +// MakeName creates a node name that follows the ethereum convention +// for such names. It adds the operation system name and Go runtime version +// the name. +func MakeName(name, version string) string { + return fmt.Sprintf("%s/v%s/%s/%s", name, version, runtime.GOOS, runtime.Version()) +} + // Server manages all peer connections. // // The fields of Server are used as configuration parameters. @@ -37,7 +45,7 @@ type Server struct { MaxPeers int // Name sets the node name of this server. - // Use ethutil.MakeVersion to create a name that follows existing conventions. + // Use MakeName to create a name that follows existing conventions. Name string // Bootstrap nodes are used to establish connectivity diff --git a/rpc/api.go b/rpc/api.go index 64e9ed285..ddba422f8 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -609,8 +609,6 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error return err } return p.WhisperMessages(args.Id, reply) - case "client_version": - *reply = p.eth.GetClientVersion() // case "eth_register": // args, err := req.ToRegisterArgs() // if err != nil { diff --git a/xeth/xeth.go b/xeth/xeth.go index b78a45f88..091743a95 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -36,7 +36,6 @@ type Backend interface { EventMux() *event.TypeMux Whisper() *whisper.Whisper Miner() *miner.Miner - ClientVersion() string } type XEth struct { @@ -165,10 +164,6 @@ func (self *XEth) IsContract(address string) bool { return len(self.State().SafeGet(address).Code()) > 0 } -func (self *XEth) GetClientVersion() string { - return self.eth.ClientVersion() -} - func (self *XEth) SecretToAddress(key string) string { pair, err := crypto.NewKeyPairFromSec(fromHex(key)) if err != nil {