diff options
author | Felix Lange <fjl@twurst.com> | 2017-01-06 23:55:03 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2017-01-07 01:18:07 +0800 |
commit | 13e3b2f433c48fe81423c1a13e9a5194ece61b01 (patch) | |
tree | 19ff7c32597a41bbfe7ccc0d32ecaed05d0e6132 /logger | |
parent | f2da6581ba827a2aab091f764ace8017b26450d8 (diff) | |
download | go-tangerine-13e3b2f433c48fe81423c1a13e9a5194ece61b01.tar go-tangerine-13e3b2f433c48fe81423c1a13e9a5194ece61b01.tar.gz go-tangerine-13e3b2f433c48fe81423c1a13e9a5194ece61b01.tar.bz2 go-tangerine-13e3b2f433c48fe81423c1a13e9a5194ece61b01.tar.lz go-tangerine-13e3b2f433c48fe81423c1a13e9a5194ece61b01.tar.xz go-tangerine-13e3b2f433c48fe81423c1a13e9a5194ece61b01.tar.zst go-tangerine-13e3b2f433c48fe81423c1a13e9a5194ece61b01.zip |
logger, pow/dagger, pow/ezp: delete dead code
Diffstat (limited to 'logger')
-rw-r--r-- | logger/example_test.go | 37 | ||||
-rw-r--r-- | logger/log.go | 65 | ||||
-rw-r--r-- | logger/loggers.go | 149 | ||||
-rw-r--r-- | logger/loggers_test.go | 192 | ||||
-rw-r--r-- | logger/logsystem.go | 76 | ||||
-rw-r--r-- | logger/sys.go | 142 | ||||
-rw-r--r-- | logger/types.go | 381 |
7 files changed, 0 insertions, 1042 deletions
diff --git a/logger/example_test.go b/logger/example_test.go deleted file mode 100644 index ce5f9da67..000000000 --- a/logger/example_test.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. - -package logger - -import "os" - -func ExampleLogger() { - logger := NewLogger("TAG") - logger.Infoln("so awesome") // prints [TAG] so awesome - logger.Infof("this %q is raw", "coin") // prints [TAG] this "coin" is raw -} - -func ExampleLogSystem() { - filename := "test.log" - file, _ := os.OpenFile(filename, os.O_RDWR|os.O_CREATE, os.ModePerm) - fileLog := NewStdLogSystem(file, 0, WarnLevel) - AddLogSystem(fileLog) - - stdoutLog := NewStdLogSystem(os.Stdout, 0, WarnLevel) - AddLogSystem(stdoutLog) - - NewLogger("TAG").Warnln("reactor meltdown") // writes to both logs -} diff --git a/logger/log.go b/logger/log.go deleted file mode 100644 index 38a6ce139..000000000 --- a/logger/log.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. - -package logger - -import ( - "fmt" - "io" - "log" - "os" - - "github.com/ethereum/go-ethereum/common" -) - -func openLogFile(datadir string, filename string) *os.File { - path := common.AbsolutePath(datadir, filename) - file, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) - if err != nil { - panic(fmt.Sprintf("error opening log file '%s': %v", filename, err)) - } - return file -} - -func New(datadir string, logFile string, logLevel int) LogSystem { - var writer io.Writer - if logFile == "" { - writer = os.Stdout - } else { - writer = openLogFile(datadir, logFile) - } - - var sys LogSystem - sys = NewStdLogSystem(writer, log.LstdFlags, LogLevel(logLevel)) - AddLogSystem(sys) - - return sys -} - -func NewJSONsystem(datadir string, logFile string) LogSystem { - var writer io.Writer - if logFile == "-" { - writer = os.Stdout - } else { - writer = openLogFile(datadir, logFile) - } - - var sys LogSystem - sys = NewJsonLogSystem(writer) - AddLogSystem(sys) - - return sys -} diff --git a/logger/loggers.go b/logger/loggers.go deleted file mode 100644 index e63355d0b..000000000 --- a/logger/loggers.go +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. - -/* -Package logger implements a multi-output leveled logger. - -Other packages use tagged logger to send log messages to shared -(process-wide) logging engine. The shared logging engine dispatches to -multiple log systems. The log level can be set separately per log -system. - -Logging is asynchronous and does not block the caller. Message -formatting is performed by the caller goroutine to avoid incorrect -logging of mutable state. -*/ -package logger - -import ( - "encoding/json" - "fmt" - "os" -) - -type LogLevel uint32 - -const ( - // Standard log levels - Silence LogLevel = iota - ErrorLevel - WarnLevel - InfoLevel - DebugLevel - DebugDetailLevel -) - -// A Logger prints messages prefixed by a given tag. It provides named -// Printf and Println style methods for all loglevels. Each ethereum -// component should have its own logger with a unique prefix. -type Logger struct { - tag string -} - -func NewLogger(tag string) *Logger { - return &Logger{"[" + tag + "] "} -} - -func (logger *Logger) Sendln(level LogLevel, v ...interface{}) { - logMessageC <- stdMsg{level, logger.tag + fmt.Sprintln(v...)} -} - -func (logger *Logger) Sendf(level LogLevel, format string, v ...interface{}) { - logMessageC <- stdMsg{level, logger.tag + fmt.Sprintf(format, v...)} -} - -// Errorln writes a message with ErrorLevel. -func (logger *Logger) Errorln(v ...interface{}) { - logger.Sendln(ErrorLevel, v...) -} - -// Warnln writes a message with WarnLevel. -func (logger *Logger) Warnln(v ...interface{}) { - logger.Sendln(WarnLevel, v...) -} - -// Infoln writes a message with InfoLevel. -func (logger *Logger) Infoln(v ...interface{}) { - logger.Sendln(InfoLevel, v...) -} - -// Debugln writes a message with DebugLevel. -func (logger *Logger) Debugln(v ...interface{}) { - logger.Sendln(DebugLevel, v...) -} - -// DebugDetailln writes a message with DebugDetailLevel. -func (logger *Logger) DebugDetailln(v ...interface{}) { - logger.Sendln(DebugDetailLevel, v...) -} - -// Errorf writes a message with ErrorLevel. -func (logger *Logger) Errorf(format string, v ...interface{}) { - logger.Sendf(ErrorLevel, format, v...) -} - -// Warnf writes a message with WarnLevel. -func (logger *Logger) Warnf(format string, v ...interface{}) { - logger.Sendf(WarnLevel, format, v...) -} - -// Infof writes a message with InfoLevel. -func (logger *Logger) Infof(format string, v ...interface{}) { - logger.Sendf(InfoLevel, format, v...) -} - -// Debugf writes a message with DebugLevel. -func (logger *Logger) Debugf(format string, v ...interface{}) { - logger.Sendf(DebugLevel, format, v...) -} - -// DebugDetailf writes a message with DebugDetailLevel. -func (logger *Logger) DebugDetailf(format string, v ...interface{}) { - logger.Sendf(DebugDetailLevel, format, v...) -} - -// Fatalln writes a message with ErrorLevel and exits the program. -func (logger *Logger) Fatalln(v ...interface{}) { - logger.Sendln(ErrorLevel, v...) - Flush() - os.Exit(0) -} - -// Fatalf writes a message with ErrorLevel and exits the program. -func (logger *Logger) Fatalf(format string, v ...interface{}) { - logger.Sendf(ErrorLevel, format, v...) - Flush() - os.Exit(0) -} - -type JsonLogger struct { - Coinbase string -} - -func NewJsonLogger() *JsonLogger { - return &JsonLogger{} -} - -func (logger *JsonLogger) LogJson(v JsonLog) { - msgname := v.EventName() - obj := map[string]interface{}{ - msgname: v, - } - - jsontxt, _ := json.Marshal(obj) - logMessageC <- (jsonMsg(jsontxt)) - -} diff --git a/logger/loggers_test.go b/logger/loggers_test.go deleted file mode 100644 index 85564698b..000000000 --- a/logger/loggers_test.go +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. - -package logger - -import ( - "io/ioutil" - "math/rand" - "os" - "sync" - "testing" - "time" -) - -type TestLogSystem struct { - mutex sync.Mutex - output string - level LogLevel -} - -func (ls *TestLogSystem) LogPrint(msg LogMsg) { - ls.mutex.Lock() - if ls.level >= msg.Level() { - ls.output += msg.String() - } - ls.mutex.Unlock() -} - -func (ls *TestLogSystem) SetLogLevel(i LogLevel) { - ls.mutex.Lock() - ls.level = i - ls.mutex.Unlock() -} - -func (ls *TestLogSystem) GetLogLevel() LogLevel { - ls.mutex.Lock() - defer ls.mutex.Unlock() - return ls.level -} - -func (ls *TestLogSystem) CheckOutput(t *testing.T, expected string) { - ls.mutex.Lock() - output := ls.output - ls.mutex.Unlock() - if output != expected { - t.Errorf("log output mismatch:\n got: %q\n want: %q\n", output, expected) - } -} - -type blockedLogSystem struct { - LogSystem - unblock chan struct{} -} - -func (ls blockedLogSystem) LogPrint(msg LogMsg) { - <-ls.unblock - ls.LogSystem.LogPrint(msg) -} - -func TestLoggerFlush(t *testing.T) { - Reset() - - logger := NewLogger("TEST") - ls := blockedLogSystem{&TestLogSystem{level: WarnLevel}, make(chan struct{})} - AddLogSystem(ls) - for i := 0; i < 5; i++ { - // these writes shouldn't hang even though ls is blocked - logger.Errorf(".") - } - - beforeFlush := time.Now() - time.AfterFunc(80*time.Millisecond, func() { close(ls.unblock) }) - Flush() // this should hang for approx. 80ms - if blockd := time.Now().Sub(beforeFlush); blockd < 80*time.Millisecond { - t.Errorf("Flush didn't block long enough, blocked for %v, should've been >= 80ms", blockd) - } - - ls.LogSystem.(*TestLogSystem).CheckOutput(t, "[TEST] .[TEST] .[TEST] .[TEST] .[TEST] .") -} - -func TestLoggerPrintln(t *testing.T) { - Reset() - - logger := NewLogger("TEST") - testLogSystem := &TestLogSystem{level: WarnLevel} - AddLogSystem(testLogSystem) - logger.Errorln("error") - logger.Warnln("warn") - logger.Infoln("info") - logger.Debugln("debug") - Flush() - - testLogSystem.CheckOutput(t, "[TEST] error\n[TEST] warn\n") -} - -func TestLoggerPrintf(t *testing.T) { - Reset() - - logger := NewLogger("TEST") - testLogSystem := &TestLogSystem{level: WarnLevel} - AddLogSystem(testLogSystem) - logger.Errorf("error to %v\n", []int{1, 2, 3}) - logger.Warnf("warn %%d %d", 5) - logger.Infof("info") - logger.Debugf("debug") - Flush() - testLogSystem.CheckOutput(t, "[TEST] error to [1 2 3]\n[TEST] warn %d 5") -} - -func TestMultipleLogSystems(t *testing.T) { - Reset() - - logger := NewLogger("TEST") - testLogSystem0 := &TestLogSystem{level: ErrorLevel} - testLogSystem1 := &TestLogSystem{level: WarnLevel} - AddLogSystem(testLogSystem0) - AddLogSystem(testLogSystem1) - logger.Errorln("error") - logger.Warnln("warn") - Flush() - - testLogSystem0.CheckOutput(t, "[TEST] error\n") - testLogSystem1.CheckOutput(t, "[TEST] error\n[TEST] warn\n") -} - -func TestFileLogSystem(t *testing.T) { - Reset() - - logger := NewLogger("TEST") - filename := "test.log" - file, _ := os.OpenFile(filename, os.O_RDWR|os.O_CREATE, os.ModePerm) - testLogSystem := NewStdLogSystem(file, 0, WarnLevel) - AddLogSystem(testLogSystem) - logger.Errorf("error to %s\n", filename) - logger.Warnln("warn") - Flush() - contents, _ := ioutil.ReadFile(filename) - output := string(contents) - if output != "[TEST] error to test.log\n[TEST] warn\n" { - t.Error("Expected contents of file 'test.log': '[TEST] error to test.log\\n[TEST] warn\\n', got ", output) - } else { - os.Remove(filename) - } -} - -func TestNoLogSystem(t *testing.T) { - Reset() - - logger := NewLogger("TEST") - logger.Warnln("warn") - Flush() -} - -func TestConcurrentAddSystem(t *testing.T) { - rand.Seed(time.Now().Unix()) - Reset() - - logger := NewLogger("TEST") - stop := make(chan struct{}) - writer := func() { - select { - case <-stop: - return - default: - logger.Infoln("foo") - Flush() - } - } - - go writer() - go writer() - - stopTime := time.Now().Add(100 * time.Millisecond) - for time.Now().Before(stopTime) { - time.Sleep(time.Duration(rand.Intn(20)) * time.Millisecond) - AddLogSystem(NewStdLogSystem(ioutil.Discard, 0, InfoLevel)) - } - close(stop) -} diff --git a/logger/logsystem.go b/logger/logsystem.go deleted file mode 100644 index 24f4351d4..000000000 --- a/logger/logsystem.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. - -package logger - -import ( - "io" - "log" - "sync/atomic" -) - -// LogSystem is implemented by log output devices. -// All methods can be called concurrently from multiple goroutines. -type LogSystem interface { - LogPrint(LogMsg) -} - -// NewStdLogSystem creates a LogSystem that prints to the given writer. -// The flag values are defined package log. -func NewStdLogSystem(writer io.Writer, flags int, level LogLevel) *StdLogSystem { - logger := log.New(writer, "", flags) - return &StdLogSystem{logger, uint32(level)} -} - -type StdLogSystem struct { - logger *log.Logger - level uint32 -} - -func (t *StdLogSystem) LogPrint(msg LogMsg) { - stdmsg, ok := msg.(stdMsg) - if ok { - if t.GetLogLevel() >= stdmsg.Level() { - t.logger.Print(stdmsg.String()) - } - } -} - -func (t *StdLogSystem) SetLogLevel(i LogLevel) { - atomic.StoreUint32(&t.level, uint32(i)) -} - -func (t *StdLogSystem) GetLogLevel() LogLevel { - return LogLevel(atomic.LoadUint32(&t.level)) -} - -// NewJSONLogSystem creates a LogSystem that prints to the given writer without -// adding extra information irrespective of loglevel only if message is JSON type -func NewJsonLogSystem(writer io.Writer) LogSystem { - logger := log.New(writer, "", 0) - return &jsonLogSystem{logger} -} - -type jsonLogSystem struct { - logger *log.Logger -} - -func (t *jsonLogSystem) LogPrint(msg LogMsg) { - jsonmsg, ok := msg.(jsonMsg) - if ok { - t.logger.Print(jsonmsg.String()) - } -} diff --git a/logger/sys.go b/logger/sys.go deleted file mode 100644 index 18d4ea641..000000000 --- a/logger/sys.go +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. - -package logger - -import ( - "fmt" - "sync" -) - -type stdMsg struct { - level LogLevel - msg string -} - -type jsonMsg []byte - -func (m jsonMsg) Level() LogLevel { - return 0 -} - -func (m jsonMsg) String() string { - return string(m) -} - -type LogMsg interface { - Level() LogLevel - fmt.Stringer -} - -func (m stdMsg) Level() LogLevel { - return m.level -} - -func (m stdMsg) String() string { - return m.msg -} - -var ( - logMessageC = make(chan LogMsg) - addSystemC = make(chan LogSystem) - flushC = make(chan chan struct{}) - resetC = make(chan chan struct{}) -) - -func init() { - go dispatchLoop() -} - -// each system can buffer this many messages before -// blocking incoming log messages. -const sysBufferSize = 500 - -func dispatchLoop() { - var ( - systems []LogSystem - systemIn []chan LogMsg - systemWG sync.WaitGroup - ) - bootSystem := func(sys LogSystem) { - in := make(chan LogMsg, sysBufferSize) - systemIn = append(systemIn, in) - systemWG.Add(1) - go sysLoop(sys, in, &systemWG) - } - - for { - select { - case msg := <-logMessageC: - for _, c := range systemIn { - c <- msg - } - - case sys := <-addSystemC: - systems = append(systems, sys) - bootSystem(sys) - - case waiter := <-resetC: - // reset means terminate all systems - for _, c := range systemIn { - close(c) - } - systems = nil - systemIn = nil - systemWG.Wait() - close(waiter) - - case waiter := <-flushC: - // flush means reboot all systems - for _, c := range systemIn { - close(c) - } - systemIn = nil - systemWG.Wait() - for _, sys := range systems { - bootSystem(sys) - } - close(waiter) - } - } -} - -func sysLoop(sys LogSystem, in <-chan LogMsg, wg *sync.WaitGroup) { - for msg := range in { - sys.LogPrint(msg) - } - wg.Done() -} - -// Reset removes all active log systems. -// It blocks until all current messages have been delivered. -func Reset() { - waiter := make(chan struct{}) - resetC <- waiter - <-waiter -} - -// Flush waits until all current log messages have been dispatched to -// the active log systems. -func Flush() { - waiter := make(chan struct{}) - flushC <- waiter - <-waiter -} - -// AddLogSystem starts printing messages to the given LogSystem. -func AddLogSystem(sys LogSystem) { - addSystemC <- sys -} diff --git a/logger/types.go b/logger/types.go deleted file mode 100644 index ee7e845de..000000000 --- a/logger/types.go +++ /dev/null @@ -1,381 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. - -package logger - -import ( - "math/big" - "time" -) - -type utctime8601 struct{} - -func (utctime8601) MarshalJSON() ([]byte, error) { - timestr := time.Now().UTC().Format(time.RFC3339Nano) - // Bounds check - if len(timestr) > 26 { - timestr = timestr[:26] - } - return []byte(`"` + timestr + `Z"`), nil -} - -type JsonLog interface { - EventName() string -} - -type LogEvent struct { - // Guid string `json:"guid"` - Ts utctime8601 `json:"ts"` - // Level string `json:"level"` -} - -type LogStarting struct { - ClientString string `json:"client_impl"` - ProtocolVersion int `json:"eth_version"` - LogEvent -} - -func (l *LogStarting) EventName() string { - return "starting" -} - -type P2PConnected struct { - RemoteId string `json:"remote_id"` - RemoteAddress string `json:"remote_addr"` - RemoteVersionString string `json:"remote_version_string"` - NumConnections int `json:"num_connections"` - LogEvent -} - -func (l *P2PConnected) EventName() string { - return "p2p.connected" -} - -type P2PDisconnected struct { - NumConnections int `json:"num_connections"` - RemoteId string `json:"remote_id"` - LogEvent -} - -func (l *P2PDisconnected) EventName() string { - return "p2p.disconnected" -} - -type EthMinerNewBlock struct { - BlockHash string `json:"block_hash"` - BlockNumber *big.Int `json:"block_number"` - ChainHeadHash string `json:"chain_head_hash"` - BlockPrevHash string `json:"block_prev_hash"` - LogEvent -} - -func (l *EthMinerNewBlock) EventName() string { - return "eth.miner.new_block" -} - -type EthChainReceivedNewBlock struct { - BlockHash string `json:"block_hash"` - BlockNumber *big.Int `json:"block_number"` - ChainHeadHash string `json:"chain_head_hash"` - BlockPrevHash string `json:"block_prev_hash"` - RemoteId string `json:"remote_id"` - LogEvent -} - -func (l *EthChainReceivedNewBlock) EventName() string { - return "eth.chain.received.new_block" -} - -type EthChainNewHead struct { - BlockHash string `json:"block_hash"` - BlockNumber *big.Int `json:"block_number"` - ChainHeadHash string `json:"chain_head_hash"` - BlockPrevHash string `json:"block_prev_hash"` - LogEvent -} - -func (l *EthChainNewHead) EventName() string { - return "eth.chain.new_head" -} - -type EthTxReceived struct { - TxHash string `json:"tx_hash"` - RemoteId string `json:"remote_id"` - LogEvent -} - -func (l *EthTxReceived) EventName() string { - return "eth.tx.received" -} - -// -// -// The types below are legacy and need to be converted to new format or deleted -// -// - -// type P2PConnecting struct { -// RemoteId string `json:"remote_id"` -// RemoteEndpoint string `json:"remote_endpoint"` -// NumConnections int `json:"num_connections"` -// LogEvent -// } - -// func (l *P2PConnecting) EventName() string { -// return "p2p.connecting" -// } - -// type P2PHandshaked struct { -// RemoteCapabilities []string `json:"remote_capabilities"` -// RemoteId string `json:"remote_id"` -// NumConnections int `json:"num_connections"` -// LogEvent -// } - -// func (l *P2PHandshaked) EventName() string { -// return "p2p.handshaked" -// } - -// type P2PDisconnecting struct { -// Reason string `json:"reason"` -// RemoteId string `json:"remote_id"` -// NumConnections int `json:"num_connections"` -// LogEvent -// } - -// func (l *P2PDisconnecting) EventName() string { -// return "p2p.disconnecting" -// } - -// type P2PDisconnectingBadHandshake struct { -// Reason string `json:"reason"` -// RemoteId string `json:"remote_id"` -// NumConnections int `json:"num_connections"` -// LogEvent -// } - -// func (l *P2PDisconnectingBadHandshake) EventName() string { -// return "p2p.disconnecting.bad_handshake" -// } - -// type P2PDisconnectingBadProtocol struct { -// Reason string `json:"reason"` -// RemoteId string `json:"remote_id"` -// NumConnections int `json:"num_connections"` -// LogEvent -// } - -// func (l *P2PDisconnectingBadProtocol) EventName() string { -// return "p2p.disconnecting.bad_protocol" -// } - -// type P2PDisconnectingReputation struct { -// Reason string `json:"reason"` -// RemoteId string `json:"remote_id"` -// NumConnections int `json:"num_connections"` -// LogEvent -// } - -// func (l *P2PDisconnectingReputation) EventName() string { -// return "p2p.disconnecting.reputation" -// } - -// type P2PDisconnectingDHT struct { -// Reason string `json:"reason"` -// RemoteId string `json:"remote_id"` -// NumConnections int `json:"num_connections"` -// LogEvent -// } - -// func (l *P2PDisconnectingDHT) EventName() string { -// return "p2p.disconnecting.dht" -// } - -// type P2PEthDisconnectingBadBlock struct { -// Reason string `json:"reason"` -// RemoteId string `json:"remote_id"` -// NumConnections int `json:"num_connections"` -// LogEvent -// } - -// func (l *P2PEthDisconnectingBadBlock) EventName() string { -// return "p2p.eth.disconnecting.bad_block" -// } - -// type P2PEthDisconnectingBadTx struct { -// Reason string `json:"reason"` -// RemoteId string `json:"remote_id"` -// NumConnections int `json:"num_connections"` -// LogEvent -// } - -// func (l *P2PEthDisconnectingBadTx) EventName() string { -// return "p2p.eth.disconnecting.bad_tx" -// } - -// type EthNewBlockBroadcasted struct { -// BlockNumber int `json:"block_number"` -// HeadHash string `json:"head_hash"` -// BlockHash string `json:"block_hash"` -// BlockDifficulty int `json:"block_difficulty"` -// BlockPrevHash string `json:"block_prev_hash"` -// LogEvent -// } - -// func (l *EthNewBlockBroadcasted) EventName() string { -// return "eth.newblock.broadcasted" -// } - -// type EthNewBlockIsKnown struct { -// BlockNumber int `json:"block_number"` -// HeadHash string `json:"head_hash"` -// BlockHash string `json:"block_hash"` -// BlockDifficulty int `json:"block_difficulty"` -// BlockPrevHash string `json:"block_prev_hash"` -// LogEvent -// } - -// func (l *EthNewBlockIsKnown) EventName() string { -// return "eth.newblock.is_known" -// } - -// type EthNewBlockIsNew struct { -// BlockNumber int `json:"block_number"` -// HeadHash string `json:"head_hash"` -// BlockHash string `json:"block_hash"` -// BlockDifficulty int `json:"block_difficulty"` -// BlockPrevHash string `json:"block_prev_hash"` -// LogEvent -// } - -// func (l *EthNewBlockIsNew) EventName() string { -// return "eth.newblock.is_new" -// } - -// type EthNewBlockMissingParent struct { -// BlockNumber int `json:"block_number"` -// HeadHash string `json:"head_hash"` -// BlockHash string `json:"block_hash"` -// BlockDifficulty int `json:"block_difficulty"` -// BlockPrevHash string `json:"block_prev_hash"` -// LogEvent -// } - -// func (l *EthNewBlockMissingParent) EventName() string { -// return "eth.newblock.missing_parent" -// } - -// type EthNewBlockIsInvalid struct { -// BlockNumber int `json:"block_number"` -// HeadHash string `json:"head_hash"` -// BlockHash string `json:"block_hash"` -// BlockDifficulty int `json:"block_difficulty"` -// BlockPrevHash string `json:"block_prev_hash"` -// LogEvent -// } - -// func (l *EthNewBlockIsInvalid) EventName() string { -// return "eth.newblock.is_invalid" -// } - -// type EthNewBlockChainIsOlder struct { -// BlockNumber int `json:"block_number"` -// HeadHash string `json:"head_hash"` -// BlockHash string `json:"block_hash"` -// BlockDifficulty int `json:"block_difficulty"` -// BlockPrevHash string `json:"block_prev_hash"` -// LogEvent -// } - -// func (l *EthNewBlockChainIsOlder) EventName() string { -// return "eth.newblock.chain.is_older" -// } - -// type EthNewBlockChainIsCanonical struct { -// BlockNumber int `json:"block_number"` -// HeadHash string `json:"head_hash"` -// BlockHash string `json:"block_hash"` -// BlockDifficulty int `json:"block_difficulty"` -// BlockPrevHash string `json:"block_prev_hash"` -// LogEvent -// } - -// func (l *EthNewBlockChainIsCanonical) EventName() string { -// return "eth.newblock.chain.is_cannonical" -// } - -// type EthNewBlockChainNotCanonical struct { -// BlockNumber int `json:"block_number"` -// HeadHash string `json:"head_hash"` -// BlockHash string `json:"block_hash"` -// BlockDifficulty int `json:"block_difficulty"` -// BlockPrevHash string `json:"block_prev_hash"` -// LogEvent -// } - -// func (l *EthNewBlockChainNotCanonical) EventName() string { -// return "eth.newblock.chain.not_cannonical" -// } - -// type EthTxCreated struct { -// TxHash string `json:"tx_hash"` -// TxSender string `json:"tx_sender"` -// TxAddress string `json:"tx_address"` -// TxHexRLP string `json:"tx_hexrlp"` -// TxNonce int `json:"tx_nonce"` -// LogEvent -// } - -// func (l *EthTxCreated) EventName() string { -// return "eth.tx.created" -// } - -// type EthTxBroadcasted struct { -// TxHash string `json:"tx_hash"` -// TxSender string `json:"tx_sender"` -// TxAddress string `json:"tx_address"` -// TxNonce int `json:"tx_nonce"` -// LogEvent -// } - -// func (l *EthTxBroadcasted) EventName() string { -// return "eth.tx.broadcasted" -// } - -// type EthTxValidated struct { -// TxHash string `json:"tx_hash"` -// TxSender string `json:"tx_sender"` -// TxAddress string `json:"tx_address"` -// TxNonce int `json:"tx_nonce"` -// LogEvent -// } - -// func (l *EthTxValidated) EventName() string { -// return "eth.tx.validated" -// } - -// type EthTxIsInvalid struct { -// TxHash string `json:"tx_hash"` -// TxSender string `json:"tx_sender"` -// TxAddress string `json:"tx_address"` -// Reason string `json:"reason"` -// TxNonce int `json:"tx_nonce"` -// LogEvent -// } - -// func (l *EthTxIsInvalid) EventName() string { -// return "eth.tx.is_invalid" -// } |