p2p/id: SET listen addrs, clearing old ones.
Juan Batiz-Benet committed
Jan 26, 2015 at 12:09 UTC
3118777a5eb9d51f2a58540ffafddf8994f6f48e
1 file changed
+3
-2
p2p/protocol/identify/id.go
+3
-2
@@ -176,8 +176,9 @@ func (ids *IDService) consumeMessage(mes *pb.Identify, c inet.Conn) {
176
lmaddrs = append(lmaddrs, maddr)
177
}
178
179
- // update our peerstore with the addresses.
180
- ids.Host.Peerstore().AddAddresses(p, lmaddrs)
179
+ // update our peerstore with the addresses. here, we SET the addresses, clearing old ones.
180
+ // We are receiving from the peer itself. this is current address ground truth.
181
+ ids.Host.Peerstore().SetAddresses(p, lmaddrs)
182
log.Debugf("%s received listen addrs for %s: %s", c.LocalPeer(), c.RemotePeer(), lmaddrs)
183
184
// get protocol versions