aboutsummaryrefslogtreecommitdiffstats
path: root/eth/protocol_test.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-02-25 21:06:59 +0800
committerzelig <viktor.tron@gmail.com>2015-02-25 21:38:37 +0800
commit16ecda951b767800b4e09ad8e86e0866b05136be (patch)
treedfb4defb949713c03e05988de1abae5123733cf5 /eth/protocol_test.go
parentcdc86965cb38335b97d0bef337e0a53ed7c7f7e3 (diff)
downloadgo-tangerine-16ecda951b767800b4e09ad8e86e0866b05136be.tar
go-tangerine-16ecda951b767800b4e09ad8e86e0866b05136be.tar.gz
go-tangerine-16ecda951b767800b4e09ad8e86e0866b05136be.tar.bz2
go-tangerine-16ecda951b767800b4e09ad8e86e0866b05136be.tar.lz
go-tangerine-16ecda951b767800b4e09ad8e86e0866b05136be.tar.xz
go-tangerine-16ecda951b767800b4e09ad8e86e0866b05136be.tar.zst
go-tangerine-16ecda951b767800b4e09ad8e86e0866b05136be.zip
integrate blockpool into eth
- remove blockpool code - remove blockpool integration test (kinda embarrassing) - remove errors.go
Diffstat (limited to 'eth/protocol_test.go')
-rw-r--r--eth/protocol_test.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/eth/protocol_test.go b/eth/protocol_test.go
index a91806a1c..f499d033e 100644
--- a/eth/protocol_test.go
+++ b/eth/protocol_test.go
@@ -11,13 +11,23 @@ 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"
ethlogger "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 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 +74,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 +126,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 +179,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)