add privkey to clientIdentity + tests
This commit is contained in:
@@ -1,13 +1,22 @@
|
||||
package p2p
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestClientIdentity(t *testing.T) {
|
||||
clientIdentity := NewSimpleClientIdentity("Ethereum(G)", "0.5.16", "test", []byte("pubkey"))
|
||||
clientIdentity := NewSimpleClientIdentity("Ethereum(G)", "0.5.16", "test", []byte("privkey"), []byte("pubkey"))
|
||||
key := clientIdentity.Privkey()
|
||||
if !bytes.Equal(key, []byte("privkey")) {
|
||||
t.Errorf("Expected Privkey to be %x, got %x", key, []byte("privkey"))
|
||||
}
|
||||
key = clientIdentity.Pubkey()
|
||||
if !bytes.Equal(key, []byte("pubkey")) {
|
||||
t.Errorf("Expected Pubkey to be %x, got %x", key, []byte("pubkey"))
|
||||
}
|
||||
clientString := clientIdentity.String()
|
||||
expected := fmt.Sprintf("Ethereum(G)/v0.5.16/test/%s/%s", runtime.GOOS, runtime.Version())
|
||||
if clientString != expected {
|
||||
|
Reference in New Issue
Block a user