aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/protocol_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'p2p/protocol_test.go')
-rw-r--r--p2p/protocol_test.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/p2p/protocol_test.go b/p2p/protocol_test.go
index b1d10ac53..6804a9d40 100644
--- a/p2p/protocol_test.go
+++ b/p2p/protocol_test.go
@@ -11,7 +11,7 @@ import (
)
type peerId struct {
- pubkey []byte
+ privKey, pubkey []byte
}
func (self *peerId) String() string {
@@ -27,6 +27,15 @@ func (self *peerId) Pubkey() (pubkey []byte) {
return
}
+func (self *peerId) PrivKey() (privKey []byte) {
+ privKey = self.privKey
+ if len(privKey) == 0 {
+ privKey = crypto.GenerateNewKeyPair().PublicKey
+ self.privKey = privKey
+ }
+ return
+}
+
func newTestPeer() (peer *Peer) {
peer = NewPeer(&peerId{}, []Cap{})
peer.pubkeyHook = func(*peerAddr) error { return nil }