diff --git a/p2p/host/autorelay/relay_finder.go b/p2p/host/autorelay/relay_finder.go index 009629a5cc..2164dcdba5 100644 --- a/p2p/host/autorelay/relay_finder.go +++ b/p2p/host/autorelay/relay_finder.go @@ -251,6 +251,9 @@ func (rf *relayFinder) updateAddrs() { // This function returns the p2p-circuit addrs for the host. // The returned addresses are of the form /p2p//p2p-circuit. func (rf *relayFinder) getCircuitAddrs() []ma.Multiaddr { + rf.relayMx.Lock() + defer rf.relayMx.Unlock() + raddrs := make([]ma.Multiaddr, 0, 4*len(rf.relays)+4) for p := range rf.relays { addrs := cleanupAddressSet(rf.host.Peerstore().Addrs(p))