aboutsummaryrefslogtreecommitdiffstats
path: root/dex/nodetable_test.go
diff options
context:
space:
mode:
authorSonic <sonic@dexon.org>2018-11-12 09:18:03 +0800
committerWei-Ning Huang <w@dexon.org>2018-12-19 20:54:27 +0800
commitaa1ab8132442249ce745dcab50f4af961ad41159 (patch)
treeaec62d0100b3d085b4512881fab633187e3eb2df /dex/nodetable_test.go
parent7a8b4a74e34ad7e1b670e620effa93ab6bdc941c (diff)
downloaddexon-aa1ab8132442249ce745dcab50f4af961ad41159.tar
dexon-aa1ab8132442249ce745dcab50f4af961ad41159.tar.gz
dexon-aa1ab8132442249ce745dcab50f4af961ad41159.tar.bz2
dexon-aa1ab8132442249ce745dcab50f4af961ad41159.tar.lz
dexon-aa1ab8132442249ce745dcab50f4af961ad41159.tar.xz
dexon-aa1ab8132442249ce745dcab50f4af961ad41159.tar.zst
dexon-aa1ab8132442249ce745dcab50f4af961ad41159.zip
dex: porting test to enode (#9)
Diffstat (limited to 'dex/nodetable_test.go')
-rw-r--r--dex/nodetable_test.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/dex/nodetable_test.go b/dex/nodetable_test.go
index 2e44eabe5..5adf0fbec 100644
--- a/dex/nodetable_test.go
+++ b/dex/nodetable_test.go
@@ -2,12 +2,12 @@ package dex
import (
"crypto/ecdsa"
+ "net"
"testing"
"time"
"github.com/dexon-foundation/dexon/common"
"github.com/dexon-foundation/dexon/crypto"
- "github.com/dexon-foundation/dexon/p2p/discover"
"github.com/dexon-foundation/dexon/p2p/enode"
)
@@ -87,7 +87,7 @@ func TestNodeTable(t *testing.T) {
}
}
-func randomID() enode.ID {
+func randomEnode() *enode.Node {
var err error
var privkey *ecdsa.PrivateKey
for {
@@ -96,5 +96,9 @@ func randomID() enode.ID {
break
}
}
- return discover.PubkeyID(&(privkey.PublicKey))
+ return enode.NewV4(&privkey.PublicKey, net.IP{}, 0, 0)
+}
+
+func randomID() enode.ID {
+ return randomEnode().ID()
}