Skip to content

Commit f88beca

Browse files
authored
basichost: add certhashes to addrs in place (#3200)
1 parent 914331b commit f88beca

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

p2p/host/basic/basic_host.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ func (h *BasicHost) AllAddrs() []ma.Multiaddr {
10041004
return finalAddrs
10051005
}
10061006

1007+
// addCertHashes adds certhashes to the relevant addresses. It modifies `addrs` in place.
10071008
func (h *BasicHost) addCertHashes(addrs []ma.Multiaddr) []ma.Multiaddr {
10081009
// This is a temporary workaround/hack that fixes #2233. Once we have a
10091010
// proper address pipeline, rework this. See the issue for more context.
@@ -1020,11 +1021,6 @@ func (h *BasicHost) addCertHashes(addrs []ma.Multiaddr) []ma.Multiaddr {
10201021
return addrs
10211022
}
10221023

1023-
// Copy addrs slice since we'll be modifying it.
1024-
addrsOld := addrs
1025-
addrs = make([]ma.Multiaddr, len(addrsOld))
1026-
copy(addrs, addrsOld)
1027-
10281024
for i, addr := range addrs {
10291025
wtOK, wtN := libp2pwebtransport.IsWebtransportMultiaddr(addr)
10301026
webrtcOK, webrtcN := libp2pwebrtc.IsWebRTCDirectMultiaddr(addr)

0 commit comments

Comments
 (0)