diff options
Diffstat (limited to 'eth/protocol_test.go')
-rw-r--r-- | eth/protocol_test.go | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/eth/protocol_test.go b/eth/protocol_test.go index 87d8974d5..c4e3e9f1b 100644 --- a/eth/protocol_test.go +++ b/eth/protocol_test.go @@ -11,13 +11,22 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/errs" "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p/discover" ) -var sys = logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.LogLevel(logger.DebugDetailLevel)) +var logsys = ethlogger.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlogger.LogLevel(ethlogger.DebugDetailLevel)) + +var ini = false + +func logInit() { + if !ini { + ethlogger.AddLogSystem(logsys) + ini = true + } +} type testMsgReadWriter struct { in chan p2p.Msg @@ -64,7 +73,7 @@ type testChainManager struct { type testBlockPool struct { addBlockHashes func(next func() ([]byte, bool), peerId string) addBlock func(block *types.Block, peerId string) (err error) - addPeer func(td *big.Int, currentBlock []byte, peerId string, requestHashes func([]byte) error, requestBlocks func([][]byte) error, peerError func(int, string, ...interface{})) (best bool) + addPeer func(td *big.Int, currentBlock []byte, peerId string, requestHashes func([]byte) error, requestBlocks func([][]byte) error, peerError func(*errs.Error)) (best bool) removePeer func(peerId string) } @@ -116,7 +125,7 @@ func (self *testBlockPool) AddBlock(block *types.Block, peerId string) { } } -func (self *testBlockPool) AddPeer(td *big.Int, currentBlock []byte, peerId string, requestBlockHashes func([]byte) error, requestBlocks func([][]byte) error, peerError func(int, string, ...interface{})) (best bool) { +func (self *testBlockPool) AddPeer(td *big.Int, currentBlock []byte, peerId string, requestBlockHashes func([]byte) error, requestBlocks func([][]byte) error, peerError func(*errs.Error)) (best bool) { if self.addPeer != nil { best = self.addPeer(td, currentBlock, peerId, requestBlockHashes, requestBlocks, peerError) } @@ -169,7 +178,7 @@ func (self *ethProtocolTester) checkError(expCode int, delay time.Duration) (err self.t.Errorf("no error after %v, expected %v", delay, expCode) return } - perr, ok := err.(*protocolError) + perr, ok := err.(*errs.Error) if ok && perr != nil { if code := perr.Code; code != expCode { self.t.Errorf("expected protocol error (code %v), got %v (%v)", expCode, code, err) |