fix: add back to peerstore dns4 addresses removed by go-libp2p identify

This commit is contained in:
Richard Ramos 2023-09-01 16:42:46 -04:00 committed by richΛrd
parent 215c7c46b6
commit e8bd38a023
1 changed files with 14 additions and 0 deletions

View File

@ -740,6 +740,20 @@ func (w *WakuNode) connect(ctx context.Context, info peer.AddrInfo) error {
return err
}
for _, addr := range info.Addrs {
// TODO: this is a temporary fix
// host.Connect adds the addresses with a TempAddressTTL
// however, identify will filter out all non IP addresses
// and expire all temporary addrs. So in the meantime, let's
// store dns4 addresses with a connectedAddressTTL, otherwise
// it will have trouble with the status fleet circuit relay addresses
// See https://github.com/libp2p/go-libp2p/issues/2550
_, err := addr.ValueForProtocol(ma.P_DNS4)
if err == nil {
w.host.Peerstore().AddAddrs(info.ID, info.Addrs, peerstore.ConnectedAddrTTL)
}
}
w.host.Peerstore().(wps.WakuPeerstore).ResetConnFailures(info)
w.metrics.RecordDial()