@@ -69,16 +69,8 @@ func testHasCertifiedAddrs(t *testing.T, h host.Host, p peer.ID, expected []ma.M
6969 require .True (t , assert .ElementsMatchf (t , expected , rec .Addrs , fmt .Sprintf ("%s did not have certified addr for %s" , h .ID (), p )))
7070}
7171
72- func testHasProtocolVersions (t * testing.T , h host.Host , p peer.ID ) {
73- v , err := h .Peerstore ().Get (p , "ProtocolVersion" )
74- if v == nil {
75- t .Error ("no protocol version" )
76- return
77- }
78- if v .(string ) != identify .DefaultProtocolVersion {
79- t .Error ("protocol mismatch" , err )
80- }
81- v , err = h .Peerstore ().Get (p , "AgentVersion" )
72+ func testHasAgentVersion (t * testing.T , h host.Host , p peer.ID ) {
73+ v , err := h .Peerstore ().Get (p , "AgentVersion" )
8274 if v .(string ) != "github.com/libp2p/go-libp2p" { // this is the default user agent
8375 t .Error ("agent version mismatch" , err )
8476 }
@@ -201,7 +193,7 @@ func TestIDService(t *testing.T) {
201193 t .Log ("test peer1 has peer2 addrs correctly" )
202194 testKnowsAddrs (t , h1 , h2p , h2 .Addrs ()) // has them
203195 testHasCertifiedAddrs (t , h1 , h2p , h2 .Peerstore ().Addrs (h2p )) // should have signed addrs also
204- testHasProtocolVersions (t , h1 , h2p )
196+ testHasAgentVersion (t , h1 , h2p )
205197 testHasPublicKey (t , h1 , h2p , h2 .Peerstore ().PubKey (h2p )) // h1 should have h2's public key
206198
207199 // now, this wait we do have to do. it's the wait for the Listening side
@@ -214,7 +206,7 @@ func TestIDService(t *testing.T) {
214206 t .Log ("test peer2 has peer1 addrs correctly" )
215207 testKnowsAddrs (t , h2 , h1p , h1 .Addrs ()) // has them
216208 testHasCertifiedAddrs (t , h2 , h1p , h1 .Peerstore ().Addrs (h1p ))
217- testHasProtocolVersions (t , h2 , h1p )
209+ testHasAgentVersion (t , h2 , h1p )
218210 testHasPublicKey (t , h2 , h1p , h1 .Peerstore ().PubKey (h1p )) // h1 should have h2's public key
219211
220212 // Need both sides to actually notice that the connection has been closed.
@@ -670,7 +662,7 @@ func TestLargeIdentifyMessage(t *testing.T) {
670662 t .Log ("test peer1 has peer2 addrs correctly" )
671663 testKnowsAddrs (t , h1 , h2p , h2 .Addrs ()) // has them
672664 testHasCertifiedAddrs (t , h1 , h2p , h2 .Peerstore ().Addrs (h2p )) // should have signed addrs also
673- testHasProtocolVersions (t , h1 , h2p )
665+ testHasAgentVersion (t , h1 , h2p )
674666 testHasPublicKey (t , h1 , h2p , h2 .Peerstore ().PubKey (h2p )) // h1 should have h2's public key
675667
676668 // now, this wait we do have to do. it's the wait for the Listening side
@@ -685,7 +677,7 @@ func TestLargeIdentifyMessage(t *testing.T) {
685677 t .Log ("test peer2 has peer1 addrs correctly" )
686678 testKnowsAddrs (t , h2 , h1p , h1 .Addrs ()) // has them
687679 testHasCertifiedAddrs (t , h2 , h1p , h1 .Peerstore ().Addrs (h1p ))
688- testHasProtocolVersions (t , h2 , h1p )
680+ testHasAgentVersion (t , h2 , h1p )
689681 testHasPublicKey (t , h2 , h1p , h1 .Peerstore ().PubKey (h1p )) // h1 should have h2's public key
690682
691683 // Need both sides to actually notice that the connection has been closed.
0 commit comments