aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/discover/node_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'p2p/discover/node_test.go')
-rw-r--r--p2p/discover/node_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/p2p/discover/node_test.go b/p2p/discover/node_test.go
index ae82ae4f1..60b01b6ca 100644
--- a/p2p/discover/node_test.go
+++ b/p2p/discover/node_test.go
@@ -133,6 +133,24 @@ func TestNodeID_recover(t *testing.T) {
if pub != recpub {
t.Errorf("recovered wrong pubkey:\ngot: %v\nwant: %v", recpub, pub)
}
+
+ ecdsa, err := pub.Pubkey()
+ if err != nil {
+ t.Errorf("Pubkey error: %v", err)
+ }
+ if !reflect.DeepEqual(ecdsa, &prv.PublicKey) {
+ t.Errorf("Pubkey mismatch:\n got: %#v\n want: %#v", ecdsa, &prv.PublicKey)
+ }
+}
+
+func TestNodeID_pubkeyBad(t *testing.T) {
+ ecdsa, err := NodeID{}.Pubkey()
+ if err == nil {
+ t.Error("expected error for zero ID")
+ }
+ if ecdsa != nil {
+ t.Error("expected nil result")
+ }
}
func TestNodeID_distcmp(t *testing.T) {