mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
p2p/netutil: fix bug in RandomAddr
This commit is contained in:
parent
df945f7c45
commit
36e5fe2b19
1 changed files with 1 additions and 1 deletions
|
|
@ -356,7 +356,7 @@ func IPToAddr(ip net.IP) netip.Addr {
|
||||||
// RandomAddr creates a random IP address.
|
// RandomAddr creates a random IP address.
|
||||||
func RandomAddr(rng *rand.Rand) netip.Addr {
|
func RandomAddr(rng *rand.Rand) netip.Addr {
|
||||||
var bytes []byte
|
var bytes []byte
|
||||||
if rng.Intn(1) == 0 {
|
if rng.Intn(2) == 0 {
|
||||||
bytes = make([]byte, 4)
|
bytes = make([]byte, 4)
|
||||||
} else {
|
} else {
|
||||||
bytes = make([]byte, 16)
|
bytes = make([]byte, 16)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue