Skip to content

Commit

Permalink
logger, pow/dagger, pow/ezp: delete dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl committed Jan 6, 2017
1 parent f2da658 commit 13e3b2f
Show file tree
Hide file tree
Showing 20 changed files with 3 additions and 1,440 deletions.
1 change: 0 additions & 1 deletion cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ func init() {
}

app.After = func(ctx *cli.Context) error {
logger.Flush()
debug.Exit()
console.Stdin.Close() // Resets terminal mode.
return nil
Expand Down
1 change: 0 additions & 1 deletion cmd/utils/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func Fatalf(format string, args ...interface{}) {
}
}
fmt.Fprintf(w, "Fatal: "+format+"\n", args...)
logger.Flush()
os.Exit(1)
}

Expand Down
6 changes: 2 additions & 4 deletions core/block_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/pow/ezp"
)

func testChainConfig() *params.ChainConfig {
Expand All @@ -48,20 +47,19 @@ func proc() (Validator, *BlockChain) {
}

func TestNumber(t *testing.T) {
pow := ezp.New()
_, chain := proc()

statedb, _ := state.New(chain.Genesis().Root(), chain.chainDb)
cfg := testChainConfig()
header := makeHeader(cfg, chain.Genesis(), statedb)
header.Number = big.NewInt(3)
err := ValidateHeader(cfg, pow, header, chain.Genesis().Header(), false, false)
err := ValidateHeader(cfg, FakePow{}, header, chain.Genesis().Header(), false, false)
if err != BlockNumberErr {
t.Errorf("expected block number error, got %q", err)
}

header = makeHeader(cfg, chain.Genesis(), statedb)
err = ValidateHeader(cfg, pow, header, chain.Genesis().Header(), false, false)
err = ValidateHeader(cfg, FakePow{}, header, chain.Genesis().Header(), false, false)
if err == BlockNumberErr {
t.Errorf("didn't expect block number error")
}
Expand Down
3 changes: 0 additions & 3 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ import (
)

var (
chainlogger = logger.NewLogger("CHAIN")
jsonlogger = logger.NewJsonLogger()

blockInsertTimer = metrics.NewTimer("chain/inserts")

ErrNoGenesis = errors.New("Genesis not found in chain")
Expand Down
22 changes: 0 additions & 22 deletions errs/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package errs
import (
"fmt"

"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
)

Expand All @@ -32,15 +31,10 @@ Fields:
Package:
name of the package/component
Level:
a function mapping error code to logger.LogLevel (severity)
if not given, errors default to logger.InfoLevel
*/
type Errors struct {
Errors map[int]string
Package string
Level func(code int) logger.LogLevel
}

/*
Expand All @@ -58,7 +52,6 @@ type Error struct {
Code int
Name string
Package string
level logger.LogLevel
message string
format string
params []interface{}
Expand All @@ -69,15 +62,10 @@ func (self *Errors) New(code int, format string, params ...interface{}) *Error {
if !ok {
panic("invalid error code")
}
level := logger.InfoLevel
if self.Level != nil {
level = self.Level(code)
}
return &Error{
Code: code,
Name: name,
Package: self.Package,
level: level,
format: format,
params: params,
}
Expand All @@ -98,13 +86,3 @@ func (self Error) Log(v glog.Verbose) {
v.Infoln(self)
}
}

/*
err.Fatal() is true if err's severity level is 0 or 1 (logger.ErrorLevel or logger.Silence)
*/
func (self *Error) Fatal() (fatal bool) {
if self.level < logger.WarnLevel {
fatal = true
}
return
}
21 changes: 0 additions & 21 deletions errs/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ package errs
import (
"fmt"
"testing"

"github.com/ethereum/go-ethereum/logger"
)

func testErrors() *Errors {
Expand All @@ -30,14 +28,6 @@ func testErrors() *Errors {
0: "zero",
1: "one",
},
Level: func(i int) (l logger.LogLevel) {
if i == 0 {
l = logger.ErrorLevel
} else {
l = logger.WarnLevel
}
return
},
}
}

Expand All @@ -49,14 +39,3 @@ func TestErrorMessage(t *testing.T) {
t.Errorf("error message incorrect. expected %v, got %v", exp, message)
}
}

func TestErrorSeverity(t *testing.T) {
err0 := testErrors().New(0, "zero detail")
if !err0.Fatal() {
t.Errorf("error should be fatal")
}
err1 := testErrors().New(1, "one detail")
if err1.Fatal() {
t.Errorf("error should not be fatal")
}
}
37 changes: 0 additions & 37 deletions logger/example_test.go

This file was deleted.

65 changes: 0 additions & 65 deletions logger/log.go

This file was deleted.

Loading

0 comments on commit 13e3b2f

Please sign in to comment.