diff --git a/p2p/switch.go b/p2p/switch.go index 6ea7e408f..dc9b1698a 100644 --- a/p2p/switch.go +++ b/p2p/switch.go @@ -568,7 +568,7 @@ func (sw *Switch) addPeer(pc peerConn) error { // and add to our addresses to avoid dialing again sw.addrBook.RemoveAddress(addr) sw.addrBook.AddOurAddress(addr) - return ErrSwitchConnectToSelf{} + return ErrSwitchConnectToSelf{addr} } // Avoid duplicate diff --git a/p2p/switch_test.go b/p2p/switch_test.go index 2c59d13e4..74e9e9776 100644 --- a/p2p/switch_test.go +++ b/p2p/switch_test.go @@ -193,7 +193,7 @@ func TestSwitchFiltersOutItself(t *testing.T) { // addr should be rejected in addPeer based on the same ID err := s1.DialPeerWithAddress(rp.Addr(), false) if assert.Error(t, err) { - assert.EqualValues(t, ErrSwitchConnectToSelf{}, err) + assert.Equal(t, ErrSwitchConnectToSelf{rp.Addr()}.Error(), err.Error()) } assert.True(t, s1.addrBook.OurAddress(rp.Addr()))