Skip to content

Commit

Permalink
fix: setFallbackIP with reported libp2p addr (#808)
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos authored Oct 17, 2023
1 parent f6460ef commit bfee996
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions waku/v2/node/localnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ func (w *WakuNode) updateLocalNode(localnode *enode.LocalNode, multiaddrs []ma.M
ip4 := ipAddr.IP.To4()
ip6 := ipAddr.IP.To16()
if ip4 != nil && !ip4.IsUnspecified() {
localnode.SetFallbackIP(ip4)
localnode.Set(enr.IPv4(ip4))
localnode.Set(enr.TCP(uint16(ipAddr.Port)))
} else {
localnode.Delete(enr.IPv4{})
localnode.Delete(enr.TCP(0))
localnode.SetFallbackIP(net.IP{127, 0, 0, 1})
}

if ip4 == nil && ip6 != nil && !ip6.IsUnspecified() {
Expand All @@ -59,8 +61,6 @@ func (w *WakuNode) updateLocalNode(localnode *enode.LocalNode, multiaddrs []ma.M
}
}

localnode.SetFallbackIP(net.IP{127, 0, 0, 1})

return wenr.Update(localnode, options...)
}

Expand Down

0 comments on commit bfee996

Please sign in to comment.