aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-13 22:05:56 +0800
committerobscuren <geffobscura@gmail.com>2015-02-13 22:05:56 +0800
commita5ea21cd85530eee6eb1bb83c37c20d009f11f74 (patch)
treee5be5bd595139ff7dfbe6261e1e659d8e7dd6f9c /eth/backend.go
parentdb24fb792cf0dab91bc85e79aecf6758349002a4 (diff)
parent38faf2c51a1e4a86cda5dfa1b4f7fdae4fd7f58d (diff)
downloadgo-tangerine-a5ea21cd85530eee6eb1bb83c37c20d009f11f74.tar.gz
go-tangerine-a5ea21cd85530eee6eb1bb83c37c20d009f11f74.tar.zst
go-tangerine-a5ea21cd85530eee6eb1bb83c37c20d009f11f74.zip
merge
Diffstat (limited to 'eth/backend.go')
-rw-r--r--eth/backend.go25
1 files changed, 14 insertions, 11 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 677b5d8e3..ab348afe5 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -17,10 +17,6 @@ import (
"github.com/ethereum/go-ethereum/whisper"
)
-const (
- seedNodeAddress = "poc-8.ethdev.com:30303"
-)
-
type Config struct {
Name string
Version string
@@ -68,7 +64,8 @@ type Ethereum struct {
txSub event.Subscription
blockSub event.Subscription
- RpcServer *rpc.JsonRpcServer
+ RpcServer rpc.RpcServer
+ WsServer rpc.RpcServer
keyManager *crypto.KeyManager
clientIdentity p2p.ClientIdentity
@@ -142,14 +139,13 @@ func New(config *Config) (*Ethereum, error) {
if err != nil {
return nil, err
}
- fmt.Println(nat)
eth.net = &p2p.Server{
Identity: clientId,
MaxPeers: config.MaxPeers,
Protocols: protocols,
Blacklist: eth.blacklist,
- NAT: p2p.UPNP(),
+ NAT: nat,
NoDial: !config.Dial,
}
@@ -220,8 +216,12 @@ func (s *Ethereum) MaxPeers() int {
return s.net.MaxPeers
}
+func (s *Ethereum) Coinbase() []byte {
+ return nil // TODO
+}
+
// Start the ethereum
-func (s *Ethereum) Start(seed bool) error {
+func (s *Ethereum) Start(seedNode string) error {
jsonlogger.LogJson(&ethlogger.LogStarting{
ClientString: s.ClientIdentity().String(),
Coinbase: ethutil.Bytes2Hex(s.KeyManager().Address()),
@@ -251,9 +251,9 @@ func (s *Ethereum) Start(seed bool) error {
go s.blockBroadcastLoop()
// TODO: read peers here
- if seed {
- logger.Infof("Connect to seed node %v", seedNodeAddress)
- if err := s.SuggestPeer(seedNodeAddress); err != nil {
+ if len(seedNode) > 0 {
+ logger.Infof("Connect to seed node %v", seedNode)
+ if err := s.SuggestPeer(seedNode); err != nil {
logger.Infoln(err)
}
}
@@ -285,6 +285,9 @@ func (s *Ethereum) Stop() {
if s.RpcServer != nil {
s.RpcServer.Stop()
}
+ if s.WsServer != nil {
+ s.WsServer.Stop()
+ }
s.txPool.Stop()
s.eventMux.Stop()
s.blockPool.Stop()