aboutsummaryrefslogtreecommitdiffstats
path: root/eth/protocol_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-02-05 10:16:16 +0800
committerFelix Lange <fjl@twurst.com>2015-02-06 07:03:59 +0800
commit56f777b2fc77275bc636562b66a08b19afe2ec56 (patch)
treec9a34bd23e13adb0d850957b9a66cd748d34b3e3 /eth/protocol_test.go
parent8e8ec8f5f8974aafeac5e4a9ead76878fe22cefd (diff)
downloadgo-tangerine-56f777b2fc77275bc636562b66a08b19afe2ec56.tar
go-tangerine-56f777b2fc77275bc636562b66a08b19afe2ec56.tar.gz
go-tangerine-56f777b2fc77275bc636562b66a08b19afe2ec56.tar.bz2
go-tangerine-56f777b2fc77275bc636562b66a08b19afe2ec56.tar.lz
go-tangerine-56f777b2fc77275bc636562b66a08b19afe2ec56.tar.xz
go-tangerine-56f777b2fc77275bc636562b66a08b19afe2ec56.tar.zst
go-tangerine-56f777b2fc77275bc636562b66a08b19afe2ec56.zip
cmd/ethereum, cmd/mist, core, eth, javascript, xeth: fixes for new p2p API
Diffstat (limited to 'eth/protocol_test.go')
-rw-r--r--eth/protocol_test.go24
1 files changed, 5 insertions, 19 deletions
diff --git a/eth/protocol_test.go b/eth/protocol_test.go
index 1fe6d8f6b..a91806a1c 100644
--- a/eth/protocol_test.go
+++ b/eth/protocol_test.go
@@ -14,6 +14,7 @@ import (
"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))
@@ -128,26 +129,11 @@ func (self *testBlockPool) RemovePeer(peerId string) {
}
}
-// TODO: refactor this into p2p/client_identity
-type peerId struct {
- pubkey []byte
-}
-
-func (self *peerId) String() string {
- return "test peer"
-}
-
-func (self *peerId) Pubkey() (pubkey []byte) {
- pubkey = self.pubkey
- if len(pubkey) == 0 {
- pubkey = crypto.GenerateNewKeyPair().PublicKey
- self.pubkey = pubkey
- }
- return
-}
-
func testPeer() *p2p.Peer {
- return p2p.NewPeer(&peerId{}, []p2p.Cap{})
+ var id discover.NodeID
+ pk := crypto.GenerateNewKeyPair().PublicKey
+ copy(id[:], pk)
+ return p2p.NewPeer(id, "test peer", []p2p.Cap{})
}
type ethProtocolTester struct {