aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go31
-rw-r--r--eth/block_pool.go4
-rw-r--r--eth/block_pool_test.go6
-rw-r--r--eth/protocol.go7
-rw-r--r--eth/protocol_test.go4
5 files changed, 28 insertions, 24 deletions
diff --git a/eth/backend.go b/eth/backend.go
index f67f9c78b..efdd43bf5 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -12,7 +12,7 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
- ethlogger "github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
@@ -23,8 +23,8 @@ import (
)
var (
- logger = ethlogger.NewLogger("SERV")
- jsonlogger = ethlogger.NewJsonLogger()
+ ethlogger = logger.NewLogger("SERV")
+ jsonlogger = logger.NewJsonLogger()
defaultBootNodes = []*discover.Node{
// ETH/DEV cmd/bootnode
@@ -74,7 +74,7 @@ func (cfg *Config) parseBootNodes() []*discover.Node {
}
n, err := discover.ParseNode(url)
if err != nil {
- logger.Errorf("Bootstrap URL %s: %v\n", url, err)
+ ethlogger.Errorf("Bootstrap URL %s: %v\n", url, err)
continue
}
ns = append(ns, n)
@@ -98,7 +98,7 @@ func (cfg *Config) nodeKey() (*ecdsa.PrivateKey, error) {
return nil, fmt.Errorf("could not generate server key: %v", err)
}
if err := ioutil.WriteFile(keyfile, crypto.FromECDSA(key), 0600); err != nil {
- logger.Errorln("could not persist nodekey: ", err)
+ ethlogger.Errorln("could not persist nodekey: ", err)
}
return key, nil
}
@@ -127,17 +127,16 @@ type Ethereum struct {
miner *miner.Miner
RpcServer rpc.RpcServer
- WsServer rpc.RpcServer
keyManager *crypto.KeyManager
- logger ethlogger.LogSystem
+ logger logger.LogSystem
Mining bool
}
func New(config *Config) (*Ethereum, error) {
// Boostrap database
- logger := ethlogger.New(config.DataDir, config.LogFile, config.LogLevel, config.LogFormat)
+ ethlogger := logger.New(config.DataDir, config.LogFile, config.LogLevel, config.LogFormat)
db, err := ethdb.NewLDBDatabase("blockchain")
if err != nil {
return nil, err
@@ -147,7 +146,7 @@ func New(config *Config) (*Ethereum, error) {
d, _ := db.Get([]byte("ProtocolVersion"))
protov := ethutil.NewValue(d).Uint()
if protov != ProtocolVersion && protov != 0 {
- path := path.Join(config.DataDir, "database")
+ path := path.Join(config.DataDir, "blockchain")
return nil, fmt.Errorf("Database version mismatch. Protocol(%d / %d). `rm -rf %s`", protov, ProtocolVersion, path)
}
@@ -174,7 +173,7 @@ func New(config *Config) (*Ethereum, error) {
keyManager: keyManager,
blacklist: p2p.NewBlacklist(),
eventMux: &event.TypeMux{},
- logger: logger,
+ logger: ethlogger,
}
eth.chainManager = core.NewChainManager(db, eth.EventMux())
@@ -216,7 +215,7 @@ func New(config *Config) (*Ethereum, error) {
}
func (s *Ethereum) KeyManager() *crypto.KeyManager { return s.keyManager }
-func (s *Ethereum) Logger() ethlogger.LogSystem { return s.logger }
+func (s *Ethereum) Logger() logger.LogSystem { return s.logger }
func (s *Ethereum) Name() string { return s.net.Name }
func (s *Ethereum) ChainManager() *core.ChainManager { return s.chainManager }
func (s *Ethereum) BlockProcessor() *core.BlockProcessor { return s.blockProcessor }
@@ -234,7 +233,7 @@ func (s *Ethereum) Coinbase() []byte { return nil } // TODO
// Start the ethereum
func (s *Ethereum) Start() error {
- jsonlogger.LogJson(&ethlogger.LogStarting{
+ jsonlogger.LogJson(&logger.LogStarting{
ClientString: s.net.Name,
ProtocolVersion: ProtocolVersion,
})
@@ -260,7 +259,7 @@ func (s *Ethereum) Start() error {
s.blockSub = s.eventMux.Subscribe(core.NewMinedBlockEvent{})
go s.blockBroadcastLoop()
- logger.Infoln("Server started")
+ ethlogger.Infoln("Server started")
return nil
}
@@ -285,9 +284,7 @@ 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()
@@ -295,7 +292,7 @@ func (s *Ethereum) Stop() {
s.whisper.Stop()
}
- logger.Infoln("Server stopped")
+ ethlogger.Infoln("Server stopped")
close(s.shutdownChan)
}
diff --git a/eth/block_pool.go b/eth/block_pool.go
index 13016c694..124a9e8c0 100644
--- a/eth/block_pool.go
+++ b/eth/block_pool.go
@@ -12,11 +12,11 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
- ethlogger "github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/pow"
)
-var poolLogger = ethlogger.NewLogger("Blockpool")
+var poolLogger = logger.NewLogger("Blockpool")
const (
blockHashesBatchSize = 256
diff --git a/eth/block_pool_test.go b/eth/block_pool_test.go
index 331dbe504..3d1b28315 100644
--- a/eth/block_pool_test.go
+++ b/eth/block_pool_test.go
@@ -12,19 +12,19 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
- ethlogger "github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/pow"
)
const waitTimeout = 60 // seconds
-var logsys = ethlogger.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlogger.LogLevel(ethlogger.DebugDetailLevel))
+var logsys = logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.LogLevel(logger.DebugDetailLevel))
var ini = false
func logInit() {
if !ini {
- ethlogger.AddLogSystem(logsys)
+ logger.AddLogSystem(logsys)
ini = true
}
}
diff --git a/eth/protocol.go b/eth/protocol.go
index 8221c1b29..a5cc8ee1a 100644
--- a/eth/protocol.go
+++ b/eth/protocol.go
@@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
)
@@ -137,6 +138,12 @@ func (self *ethProtocol) handle() error {
if err := msg.Decode(&txs); err != nil {
return self.protoError(ErrDecode, "msg %v: %v", msg, err)
}
+ for _, tx := range txs {
+ jsonlogger.LogJson(&logger.EthTxReceived{
+ TxHash: ethutil.Bytes2Hex(tx.Hash()),
+ RemoteId: self.peer.ID().String(),
+ })
+ }
self.txPool.AddTransactions(txs)
case GetBlockHashesMsg:
diff --git a/eth/protocol_test.go b/eth/protocol_test.go
index a91806a1c..87d8974d5 100644
--- a/eth/protocol_test.go
+++ b/eth/protocol_test.go
@@ -12,12 +12,12 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
- ethlogger "github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
)
-var sys = ethlogger.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlogger.LogLevel(ethlogger.DebugDetailLevel))
+var sys = logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.LogLevel(logger.DebugDetailLevel))
type testMsgReadWriter struct {
in chan p2p.Msg