diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-06 00:21:32 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-06 00:21:32 +0800 |
commit | ba0c41436c8a067937aa0845963f9ec3b81e7aed (patch) | |
tree | 7bd9bbc9422353ab341f01581abeb346b5a6cacf /p2p/discover/node_test.go | |
parent | fabaf4f1f01db773f6c0c2e9a9499736b1a40848 (diff) | |
parent | 215c763d53fc8e06e8c9807875eacaccf3ef45fa (diff) | |
download | go-tangerine-ba0c41436c8a067937aa0845963f9ec3b81e7aed.tar go-tangerine-ba0c41436c8a067937aa0845963f9ec3b81e7aed.tar.gz go-tangerine-ba0c41436c8a067937aa0845963f9ec3b81e7aed.tar.bz2 go-tangerine-ba0c41436c8a067937aa0845963f9ec3b81e7aed.tar.lz go-tangerine-ba0c41436c8a067937aa0845963f9ec3b81e7aed.tar.xz go-tangerine-ba0c41436c8a067937aa0845963f9ec3b81e7aed.tar.zst go-tangerine-ba0c41436c8a067937aa0845963f9ec3b81e7aed.zip |
Merge branch 'p2p-handshake-2' of https://github.com/fjl/go-ethereum into fjl-p2p-handshake-2
Diffstat (limited to 'p2p/discover/node_test.go')
-rw-r--r-- | p2p/discover/node_test.go | 18 |
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) { |